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 43
43
VFS for Git (which is less flexible). Only update that version if we rely upon a
44
44
new command-line interface in Git or if there is a truly broken interaction.
45
45
-->
46
- <GitPackageVersion >2.20200323.8 </GitPackageVersion >
46
+ <GitPackageVersion >2.20200402.1 </GitPackageVersion >
47
47
<MinimumGitVersion >v2.25.0.vfs.1.1</MinimumGitVersion >
48
48
49
49
<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
13
13
{
14
14
public class GitProcess : ICredentialStore
15
15
{
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
+
16
34
private const int HResultEHANDLE = - 2147024890 ; // 0x80070006 E_HANDLE
17
35
18
36
private static readonly Encoding UTF8NoBOM = new UTF8Encoding ( false ) ;
@@ -572,10 +590,11 @@ public Result WriteCommitGraph(string objectDir)
572
590
{
573
591
// Do not expire commit-graph files that have been modified in the last hour.
574
592
// 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 } \" ";
576
594
return this . InvokeGitInWorkingDirectoryRoot ( command , fetchMissingObjects : true ) ;
577
595
}
578
596
597
+
579
598
public Result VerifyCommitGraph ( string objectDir )
580
599
{
581
600
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
18
18
private MockGitProcess gitProcess ;
19
19
private ScalarContext context ;
20
20
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
+
22
23
private string CommitGraphVerifyCommand => $ "commit-graph verify --shallow --object-dir \" { this . context . Enlistment . GitObjectsRoot } \" ";
23
24
24
25
[ TestCase ]
You can’t perform that action at this time.
0 commit comments