@@ -29,6 +29,8 @@ public GitInstaller(IEnvironment environment, IProcessManager processManager,
29
29
30
30
public GitInstallationState SetupGitIfNeeded ( GitInstallationState state = null )
31
31
{
32
+ var skipSystemProbing = state != null ;
33
+
32
34
state = VerifyGitSettings ( state ) ;
33
35
if ( state . GitIsValid && state . GitLfsIsValid )
34
36
{
@@ -37,9 +39,12 @@ public GitInstallationState SetupGitIfNeeded(GitInstallationState state = null)
37
39
return state ;
38
40
}
39
41
40
- if ( environment . IsMac )
41
- state = FindSystemGit ( state ) ;
42
- state = SetDefaultPaths ( state ) ;
42
+ if ( ! skipSystemProbing )
43
+ {
44
+ if ( environment . IsMac )
45
+ state = FindSystemGit ( state ) ;
46
+ state = SetDefaultPaths ( state ) ;
47
+ }
43
48
44
49
state = CheckForUpdates ( state ) ;
45
50
@@ -111,7 +116,7 @@ public GitInstallationState FindSystemGit(GitInstallationState state)
111
116
112
117
public GitInstallationState SetDefaultPaths ( GitInstallationState state )
113
118
{
114
- if ( ! state . GitIsValid )
119
+ if ( ! state . GitIsValid && environment . IsWindows )
115
120
{
116
121
state . GitInstallationPath = installDetails . GitInstallationPath ;
117
122
state . GitExecutablePath = installDetails . GitExecutablePath ;
@@ -292,10 +297,10 @@ private GitInstallationState ExtractGit(GitInstallationState state)
292
297
} ) ;
293
298
unzipTask . Progress ( p => ( ( Progress ) Progress ) ? . UpdateProgress ( 60 + ( long ) ( 20 * p . Percentage ) , 100 , unzipTask . Name ) ) ;
294
299
var path = unzipTask . RunWithReturn ( true ) ;
295
- var target = state . GitLfsExecutablePath ;
300
+ var target = state . GitLfsInstallationPath ;
296
301
if ( unzipTask . Successful )
297
302
{
298
- var source = path . Combine ( installDetails . GitLfsExecutable ) ;
303
+ var source = path ;
299
304
target . DeleteIfExists ( ) ;
300
305
target . EnsureParentDirectoryExists ( ) ;
301
306
source . Move ( target ) ;
@@ -335,8 +340,8 @@ public class GitInstallDetails
335
340
private const string packageFeed = "http://github-vs.s3.amazonaws.com/unity/git/" ;
336
341
#endif
337
342
338
- private const string PackageVersion = "f02737a78695063deace08e96d5042710d3e32db " ;
339
- private const string PackageName = "PortableGit " ;
343
+ public const string GitDirectory = "git " ;
344
+ public const string GitLfsDirectory = "git-lfs " ;
340
345
341
346
private const string gitZip = "git.zip" ;
342
347
private const string gitLfsZip = "git-lfs.zip" ;
@@ -352,46 +357,33 @@ public GitInstallDetails(NPath baseDataPath, bool onWindows)
352
357
GitZipPath = ZipPath . Combine ( gitZip ) ;
353
358
GitLfsZipPath = ZipPath . Combine ( gitLfsZip ) ;
354
359
355
- var gitInstallPath = baseDataPath . Combine ( PackageNameWithVersion ) ;
356
- GitInstallationPath = gitInstallPath ;
360
+ GitInstallationPath = baseDataPath . Combine ( GitDirectory ) ;
361
+ GitExecutablePath = GitInstallationPath . Combine ( onWindows ? "cmd" : "bin" , "git" + DefaultEnvironment . ExecutableExt ) ;
362
+
363
+ GitLfsInstallationPath = baseDataPath . Combine ( GitLfsDirectory ) ;
364
+ GitLfsExecutablePath = GitLfsInstallationPath . Combine ( "git-lfs" + DefaultEnvironment . ExecutableExt ) ;
357
365
358
366
if ( onWindows )
359
367
{
360
- GitExecutable += "git.exe" ;
361
- GitLfsExecutable += "git-lfs.exe" ;
362
- GitExecutablePath = gitInstallPath . Combine ( "cmd" , GitExecutable ) ;
363
368
GitPackageFeed = packageFeed + $ "windows/{ GitPackageName } ";
364
369
GitLfsPackageFeed = packageFeed + $ "windows/{ GitLfsPackageName } ";
365
370
}
366
371
else
367
372
{
368
- GitExecutable = "git" ;
369
- GitLfsExecutable = "git-lfs" ;
370
- GitExecutablePath = gitInstallPath . Combine ( "bin" , GitExecutable ) ;
371
373
GitPackageFeed = packageFeed + $ "mac/{ GitPackageName } ";
372
374
GitLfsPackageFeed = packageFeed + $ "mac/{ GitLfsPackageName } ";
373
375
}
374
- GitLfsExecutablePath = GetGitLfsExecutablePath ( gitInstallPath ) ;
375
- }
376
-
377
- public NPath GetGitLfsExecutablePath ( NPath gitInstallRoot )
378
- {
379
- return onWindows
380
- ? gitInstallRoot . Combine ( "mingw32" , "libexec" , "git-core" , GitLfsExecutable )
381
- : gitInstallRoot . Combine ( "libexec" , "git-core" , GitLfsExecutable ) ;
382
376
}
383
377
384
378
public NPath ZipPath { get ; }
385
379
public NPath GitZipPath { get ; }
386
380
public NPath GitLfsZipPath { get ; }
387
381
public NPath GitInstallationPath { get ; }
388
- public string GitExecutable { get ; }
382
+ public NPath GitLfsInstallationPath { get ; }
389
383
public NPath GitExecutablePath { get ; }
390
- public string GitLfsExecutable { get ; }
391
384
public NPath GitLfsExecutablePath { get ; }
392
385
public UriString GitPackageFeed { get ; set ; }
393
386
public UriString GitLfsPackageFeed { get ; set ; }
394
- public string PackageNameWithVersion => PackageName + "_" + PackageVersion ;
395
387
}
396
388
}
397
389
}
0 commit comments