Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GVFS/GVFS.Build/GVFS.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup Label="Parameters">
<GVFSVersion>0.2.173.2</GVFSVersion>
<GitPackageVersion>2.20200323.8</GitPackageVersion>
<GitPackageVersion>2.20200402.1</GitPackageVersion>
</PropertyGroup>

<PropertyGroup Label="DefaultSettings">
Expand Down
16 changes: 15 additions & 1 deletion GVFS/GVFS.Common/Git/GitProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class GitProcess : ICredentialStore

private static readonly Encoding UTF8NoBOM = new UTF8Encoding(false);
private static bool failedToSetEncoding = false;
private static string expireTimeDateString;

/// <summary>
/// Lock taken for duration of running executingProcess.
Expand Down Expand Up @@ -81,6 +82,19 @@ public GitProcess(string gitBinPath, string workingDirectoryRoot)
}
}

public static string ExpireTimeDateString
{
get
{
if (expireTimeDateString == null)
{
expireTimeDateString = DateTime.Now.Subtract(TimeSpan.FromDays(1)).ToShortDateString();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we chose to expire after 1 hour and now we are after 1 day. I know that this was never working before and I don't think that will be an issue because I don't think it should be creating that many commit graphs but wanted to get your thoughts. Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The important thing is that it doesn't expire things right away, and there are some concerns about timezones and things when it parses the expiry date. So either we get really specific about the time (including timezone offset) or we can just go "at least 24 hours ago, give or take timezone shifts of +/-12 hours".

Since we've been running with the lack of expirations for this long, having a slightly longer expire window will not be a problem.

}

return expireTimeDateString;
}
}

public bool LowerPriority { get; set; }

public static Result Init(Enlistment enlistment)
Expand Down Expand Up @@ -540,7 +554,7 @@ public Result WriteCommitGraph(string objectDir, List<string> packs)
{
// Do not expire commit-graph files that have been modified in the last hour.
// This will prevent deleting any commit-graph files that are currently in the commit-graph-chain.
string command = $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time={1 * 60 * 60} --object-dir \"{objectDir}\"";
string command = $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time={ExpireTimeDateString} --object-dir \"{objectDir}\"";
return this.InvokeGitInWorkingDirectoryRoot(
command,
useReadObjectHook: true,
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.UnitTests/Maintenance/PostFetchStepTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class PostFetchStepTests
private MockGitProcess gitProcess;
private GVFSContext context;

private string CommitGraphWriteCommand => $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time=3600 --object-dir \"{this.context.Enlistment.GitObjectsRoot}\"";
private string CommitGraphWriteCommand => $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time={GitProcess.ExpireTimeDateString} --object-dir \"{this.context.Enlistment.GitObjectsRoot}\"";
private string CommitGraphVerifyCommand => $"commit-graph verify --shallow --object-dir \"{this.context.Enlistment.GitObjectsRoot}\"";

[TestCase]
Expand Down