@@ -404,7 +404,7 @@ public async Task GetSourceAsync(
404
404
405
405
// Make sure the build machine met all requirements for the git repository
406
406
// For now, the requirement we have are:
407
- // 1. git version greater than 2.9 and git-lfs version greater than 2.1 for on-prem tfsgit
407
+ // 1. git version greater than 2.9 and git-lfs version greater than 2.1 for on-prem tfsgit
408
408
// 2. git version greater than 2.14.2 if use SChannel for SSL backend (Windows only)
409
409
RequirementCheck ( executionContext , repository , gitCommandManager ) ;
410
410
string username = string . Empty ;
@@ -684,17 +684,7 @@ public async Task GetSourceAsync(
684
684
executionContext . Warning ( "Unable turn off git auto garbage collection, git fetch operation may trigger auto garbage collection which will affect the performance of fetching." ) ;
685
685
}
686
686
687
- if ( AgentKnobs . FixPossibleGitOutOfMemoryProblem . GetValue ( executionContext ) . AsBoolean ( ) )
688
- {
689
- await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.threads" , "1" ) ;
690
- await gitCommandManager . GitConfig ( executionContext , targetPath , "http.postBuffer" , "524288000" ) ;
691
- await gitCommandManager . GitConfig ( executionContext , targetPath , "core.packedgitwindowsize" , "256m" ) ;
692
- await gitCommandManager . GitConfig ( executionContext , targetPath , "core.packedgitlimit" , "256m" ) ;
693
- await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.windowmemory" , "256m" ) ;
694
- await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.deltaCacheSize" , "256m" ) ;
695
- await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.packSizeLimit" , "256m" ) ;
696
- await gitCommandManager . GitConfig ( executionContext , targetPath , "core.longpaths" , "true" ) ;
697
- }
687
+ SetGitFeatureFlagsConfiguration ( executionContext , gitCommandManager , targetPath ) ;
698
688
699
689
// always remove any possible left extraheader setting from git config.
700
690
if ( await gitCommandManager . GitConfigExist ( executionContext , targetPath , $ "http.{ repositoryUrl . AbsoluteUri } .extraheader") )
@@ -1315,6 +1305,32 @@ public async Task PostJobCleanupAsync(AgentTaskPluginExecutionContext executionC
1315
1305
}
1316
1306
}
1317
1307
1308
+ public async void SetGitFeatureFlagsConfiguration (
1309
+ AgentTaskPluginExecutionContext executionContext ,
1310
+ IGitCliManager gitCommandManager ,
1311
+ string targetPath )
1312
+ {
1313
+ if ( AgentKnobs . UseGitSingleThread . GetValue ( executionContext ) . AsBoolean ( ) )
1314
+ {
1315
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.threads" , "1" ) ;
1316
+ }
1317
+
1318
+ if ( AgentKnobs . FixPossibleGitOutOfMemoryProblem . GetValue ( executionContext ) . AsBoolean ( ) )
1319
+ {
1320
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.windowmemory" , "256m" ) ;
1321
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.deltaCacheSize" , "256m" ) ;
1322
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "pack.packSizeLimit" , "256m" ) ;
1323
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "http.postBuffer" , "524288000" ) ;
1324
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "core.packedgitwindowsize" , "256m" ) ;
1325
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "core.packedgitlimit" , "256m" ) ;
1326
+ }
1327
+
1328
+ if ( AgentKnobs . UseGitLongPaths . GetValue ( executionContext ) . AsBoolean ( ) )
1329
+ {
1330
+ await gitCommandManager . GitConfig ( executionContext , targetPath , "core.longpaths" , "true" ) ;
1331
+ }
1332
+ }
1333
+
1318
1334
protected virtual GitCliManager GetCliManager ( Dictionary < string , string > gitEnv = null )
1319
1335
{
1320
1336
return new GitCliManager ( gitEnv ) ;
0 commit comments