@@ -17,81 +17,60 @@ public ProcessEnvironment(IEnvironment environment)
17
17
18
18
public void Configure ( ProcessStartInfo psi , NPath workingDirectory , bool dontSetupGit = false )
19
19
{
20
+ Guard . ArgumentNotNull ( psi , "psi" ) ;
21
+
20
22
psi . WorkingDirectory = workingDirectory ;
21
23
psi . EnvironmentVariables [ "HOME" ] = NPath . HomeDirectory ;
22
24
psi . EnvironmentVariables [ "TMP" ] = psi . EnvironmentVariables [ "TEMP" ] = NPath . SystemTemp ;
23
25
psi . EnvironmentVariables [ "GHU_WORKINGDIR" ] = workingDirectory ;
24
-
25
-
26
- Logger . Trace ( "Default System PATH:{0}" , Environment . GetEnvironmentVariable ( "PATH" ) ) ;
27
- Logger . Trace ( "Configure DontSetupGit:{0}" , dontSetupGit ) ;
26
+ psi . EnvironmentVariables [ "PATH" ] = Environment . Path ;
27
+ psi . EnvironmentVariables [ "GHU_FULLPATH" ] = Environment . Path ;
28
28
29
29
// if we don't know where git is, then there's nothing else to configure
30
30
if ( ! Environment . GitInstallPath . IsInitialized || dontSetupGit )
31
31
return ;
32
-
33
- Guard . ArgumentNotNull ( psi , "psi" ) ;
34
-
35
- // We need to essentially fake up what git-cmd.bat does
36
-
37
- var gitPathRoot = Environment . GitInstallPath ;
38
- var gitLfsPath = Environment . GitInstallPath ;
39
- var gitExecutableDir = Environment . GitExecutablePath . Parent ; // original path to git (might be different from install path if it's a symlink)
40
-
41
- Logger . Trace ( "Environment.GitExecutablePath: {0}" , Environment . GitExecutablePath ) ;
42
-
43
- // Paths to developer tools such as msbuild.exe
44
- //var developerPaths = StringExtensions.JoinForAppending(";", developerEnvironment.GetPaths());
45
- var developerPaths = "" ;
46
-
32
+
33
+ var httpProxy = Environment . GetEnvironmentVariable ( "HTTP_PROXY" ) ;
34
+ if ( ! String . IsNullOrEmpty ( httpProxy ) )
35
+ psi . EnvironmentVariables [ "HTTP_PROXY" ] = httpProxy ;
36
+
37
+ var httpsProxy = Environment . GetEnvironmentVariable ( "HTTPS_PROXY" ) ;
38
+ if ( ! String . IsNullOrEmpty ( httpsProxy ) )
39
+ psi . EnvironmentVariables [ "HTTPS_PROXY" ] = httpsProxy ;
40
+
47
41
//TODO: Remove with Git LFS Locking becomes standard
48
42
psi . EnvironmentVariables [ "GITLFSLOCKSENABLED" ] = "1" ;
49
43
50
- string path ;
51
- var baseExecPath = gitPathRoot ;
52
- var binPath = baseExecPath ;
53
44
if ( Environment . IsWindows )
54
45
{
46
+ // We need to essentially fake up what git-cmd.bat does
47
+ var gitPathRoot = Environment . GitInstallPath ;
48
+
49
+ var baseExecPath = gitPathRoot ;
55
50
if ( baseExecPath . DirectoryExists ( "mingw32" ) )
56
51
baseExecPath = baseExecPath . Combine ( "mingw32" ) ;
57
52
else
58
53
baseExecPath = baseExecPath . Combine ( "mingw64" ) ;
59
- binPath = baseExecPath . Combine ( "bin" ) ;
60
- }
61
-
62
- var execPath = baseExecPath . Combine ( "libexec" , "git-core" ) ;
63
- if ( ! execPath . DirectoryExists ( ) )
64
- execPath = NPath . Default ;
54
+ var binPath = baseExecPath . Combine ( "bin" ) ;
55
+
56
+ var execPath = baseExecPath . Combine ( "libexec" , "git-core" ) ;
57
+ if ( ! execPath . DirectoryExists ( ) )
58
+ execPath = NPath . Default ;
65
59
66
- if ( Environment . IsWindows )
67
- {
68
60
var userPath = @"C:\windows\system32;C:\windows" ;
69
- path = $ "{ gitPathRoot } \\ cmd;{ gitPathRoot } \\ usr\\ bin;{ execPath } ;{ binPath } ;{ gitLfsPath } ;{ userPath } { developerPaths } ";
70
- }
71
- else
72
- {
73
- path = $ "{ gitExecutableDir } :{ binPath } :{ execPath } :{ gitLfsPath } :{ Environment . Path } :{ developerPaths } ";
61
+ var path = $ "{ gitPathRoot } \\ cmd;{ gitPathRoot } \\ usr\\ bin;{ execPath } ;{ binPath } ";
62
+
63
+ Logger . Trace ( "Calculated Path: {0}" , path ) ;
64
+
65
+ if ( execPath . IsInitialized )
66
+ psi . EnvironmentVariables [ "GIT_EXEC_PATH" ] = execPath . ToString ( ) ;
67
+
68
+ psi . EnvironmentVariables [ "PATH" ] = path ;
69
+ psi . EnvironmentVariables [ "GHU_FULLPATH" ] = path ;
70
+
71
+ psi . EnvironmentVariables [ "PLINK_PROTOCOL" ] = "ssh" ;
72
+ psi . EnvironmentVariables [ "TERM" ] = "msys" ;
74
73
}
75
-
76
- Logger . Trace ( "Environment Path: {0}" , Environment . Path ) ;
77
- Logger . Trace ( "Calculated Path: {0}" , path ) ;
78
-
79
- if ( execPath . IsInitialized )
80
- psi . EnvironmentVariables [ "GIT_EXEC_PATH" ] = execPath . ToString ( ) ;
81
-
82
- psi . EnvironmentVariables [ "PATH" ] = path ;
83
- psi . EnvironmentVariables [ "GHU_FULLPATH" ] = path ;
84
-
85
- psi . EnvironmentVariables [ "PLINK_PROTOCOL" ] = "ssh" ;
86
- psi . EnvironmentVariables [ "TERM" ] = "msys" ;
87
-
88
- var httpProxy = Environment . GetEnvironmentVariable ( "HTTP_PROXY" ) ;
89
- if ( ! String . IsNullOrEmpty ( httpProxy ) )
90
- psi . EnvironmentVariables [ "HTTP_PROXY" ] = httpProxy ;
91
-
92
- var httpsProxy = Environment . GetEnvironmentVariable ( "HTTPS_PROXY" ) ;
93
- if ( ! String . IsNullOrEmpty ( httpsProxy ) )
94
- psi . EnvironmentVariables [ "HTTPS_PROXY" ] = httpsProxy ;
95
74
}
96
75
}
97
76
}
0 commit comments