File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
Scalar.UnitTests/Maintenance Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 4343 VFS for Git (which is less flexible). Only update that version if we rely upon a
4444 new command-line interface in Git or if there is a truly broken interaction.
4545 -->
46- <GitPackageVersion >2.20200323.8 </GitPackageVersion >
46+ <GitPackageVersion >2.20200402.1 </GitPackageVersion >
4747 <MinimumGitVersion >v2.25.0.vfs.1.1</MinimumGitVersion >
4848
4949 <WatchmanPackageUrl >https://github.com/facebook/watchman/suites/307436006/artifacts/304557</WatchmanPackageUrl >
Original file line number Diff line number Diff line change @@ -13,6 +13,24 @@ namespace Scalar.Common.Git
1313{
1414 public class GitProcess : ICredentialStore
1515 {
16+ /// <remarks>
17+ /// For UnitTest purposes
18+ /// </remarks>
19+ public static string ExpireTimeDateString
20+ {
21+ get
22+ {
23+ if ( expireTimeDateString == null )
24+ {
25+ expireTimeDateString = DateTime . Now . Subtract ( TimeSpan . FromDays ( 1 ) ) . ToShortDateString ( ) ;
26+ }
27+
28+ return expireTimeDateString ;
29+ }
30+ }
31+
32+ private static string expireTimeDateString ;
33+
1634 private const int HResultEHANDLE = - 2147024890 ; // 0x80070006 E_HANDLE
1735
1836 private static readonly Encoding UTF8NoBOM = new UTF8Encoding ( false ) ;
@@ -572,10 +590,11 @@ public Result WriteCommitGraph(string objectDir)
572590 {
573591 // Do not expire commit-graph files that have been modified in the last hour.
574592 // This will prevent deleting any commit-graph files that are currently in the commit-graph-chain.
575- string command = $ "commit-graph write --reachable --split --size-multiple=4 --expire-time={ 1 * 60 * 60 } --object-dir \" { objectDir } \" ";
593+ string command = $ "commit-graph write --reachable --split --size-multiple=4 --expire-time={ ExpireTimeDateString } --object-dir \" { objectDir } \" ";
576594 return this . InvokeGitInWorkingDirectoryRoot ( command , fetchMissingObjects : true ) ;
577595 }
578596
597+
579598 public Result VerifyCommitGraph ( string objectDir )
580599 {
581600 string command = "commit-graph verify --shallow --object-dir \" " + objectDir + "\" " ;
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ public class CommitGraphStepTests
1818 private MockGitProcess gitProcess ;
1919 private ScalarContext context ;
2020
21- private string CommitGraphWriteCommand => $ "commit-graph write --reachable --split --size-multiple=4 --expire-time=3600 --object-dir \" { this . context . Enlistment . GitObjectsRoot } \" ";
21+ private string CommitGraphWriteCommand => $ "commit-graph write --reachable --split --size-multiple=4 --expire-time={ GitProcess . ExpireTimeDateString } --object-dir \" { this . context . Enlistment . GitObjectsRoot } \" ";
22+
2223 private string CommitGraphVerifyCommand => $ "commit-graph verify --shallow --object-dir \" { this . context . Enlistment . GitObjectsRoot } \" ";
2324
2425 [ TestCase ]
You can’t perform that action at this time.
0 commit comments