Skip to content

Commit

Permalink
installer: infer defaults also from ProgramData
Browse files Browse the repository at this point in the history
We write some settings to C:\ProgramData\Git\config: those that are
deemed not special to Git for Windows, but of use to any Git
implementation. Example: core.autocrlf.

So let's look at ProgramData first to figure out whether there were any
second thoughts about previous install options, after the fact. Because
we can.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Feb 20, 2019
1 parent dfb308c commit e1e83d7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions installer/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -669,15 +669,26 @@ begin
end;
end;
function GetDefaultsFromGitSystemConfig():Boolean;
function GetDefaultsFromGitConfig(WhichOne:String):Boolean;
var
TmpFile,Key,Value:String;
ExtraOptions,TmpFile,Key,Value:String;
FileContents:AnsiString;
Values:TArrayOfString;
c,i,j,k:Integer;
begin
case WhichOne of
'ProgramData': ExtraOptions:='-f "'+ExpandConstant('{commonappdata}\Git\config')+'"';
'system': ExtraOptions:='--system';
else
begin
LogError('Invalid config type: '+WhichOne);
Result:=False;
Exit
end
end;
TmpFile:=ExpandConstant('{tmp}\git-config-get.txt');
if not Exec(ExpandConstant('{cmd}'),'/C .\{#MINGW_BITNESS}\bin\git.exe config -l -z --system >'+#34+TmpFile+#34,
if not Exec(ExpandConstant('{cmd}'),'/C .\{#MINGW_BITNESS}\bin\git.exe config -l -z '+ExtraOptions+' >'+#34+TmpFile+#34,
AppDir,SW_HIDE,ewWaitUntilTerminated,i) then
LogError('Unable to get system config');
Expand Down Expand Up @@ -1455,7 +1466,8 @@ begin
InferredDefaultValues:=TStringList.Create;
QueryUninstallValues();
AppDir:=UninstallAppPath;
GetDefaultsFromGitSystemConfig();
GetDefaultsFromGitConfig('ProgramData');
GetDefaultsFromGitConfig('system');
ChosenOptions:='';
Expand Down

0 comments on commit e1e83d7

Please sign in to comment.