diff --git a/installer/environment.inc.iss b/installer/environment.inc.iss index 060aa51a78..18cf76d17d 100644 --- a/installer/environment.inc.iss +++ b/installer/environment.inc.iss @@ -113,3 +113,31 @@ begin // Also update the environment of the current process. SetEnvironmentVariable(VarName,Path); end; + +// Sets the contents of the specified environment variable for the current process. +function SetEnvironmentVariable2(lpName:String;lpValue:LongInt):Boolean; +#ifdef UNICODE +external 'SetEnvironmentVariableW@Kernel32.dll stdcall delayload'; +#else +external 'SetEnvironmentVariableA@Kernel32.dll stdcall delayload'; +#endif + +function SanitizeGitEnvironmentVariables:Boolean; +begin + Result:=True; + if not SetEnvironmentVariable2('GIT_INDEX_FILE',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_INDEX_VERSION',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_OBJECT_DIRECTORY',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_ALTERNATE_OBJECT_DIRECTORIES',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_DIR',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_WORK_TREE',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_NAMESPACE',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_CEILING_DIRECTORIES',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_DISCOVERY_ACROSS_FILESYSTEM',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_COMMON_DIR',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_DEFAULT_HASH',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_CONFIG',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_CONFIG_GLOBAL',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_CONFIG_SYSTEM',0) then Result:=False; + if not SetEnvironmentVariable2('GIT_CONFIG_NOSYSTEM',0) then Result:=False; +end; diff --git a/installer/install.iss b/installer/install.iss index 6866b505f1..24d223342b 100644 --- a/installer/install.iss +++ b/installer/install.iss @@ -1798,6 +1798,8 @@ var Data:String; LblInfo:TLabel; begin + SanitizeGitEnvironmentVariables(); + InferredDefaultKeys:=TStringList.Create; InferredDefaultValues:=TStringList.Create; QueryUninstallValues();