Skip to content

Commit 2e5df30

Browse files
committed
PostFetchStep: delete and rewrite commit-graph on write error
We are no longer using 'verify' to check that our commit-graph is valid, but we can still discover some errors during the 'write' command. We currently never recover from this problem. If we inspect the response from the 'write' command, then we can delete and rewrite on failure. This will resolve some issues that users are seeing right now. Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
1 parent 7cc1786 commit 2e5df30

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

GVFS/GVFS.Common/Maintenance/PostFetchStep.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ protected override void PerformMaintenance()
4646
string commitGraphLockPath = Path.Combine(this.Context.Enlistment.GitObjectsRoot, "info", CommitGraphLock);
4747
this.Context.FileSystem.TryDeleteFile(commitGraphLockPath);
4848

49-
this.RunGitCommand((process) => process.WriteCommitGraph(this.Context.Enlistment.GitObjectsRoot, this.packIndexes), nameof(GitProcess.WriteCommitGraph));
49+
GitProcess.Result writeResult = this.RunGitCommand((process) => process.WriteCommitGraph(this.Context.Enlistment.GitObjectsRoot, this.packIndexes), nameof(GitProcess.WriteCommitGraph));
50+
51+
if (writeResult.ExitCodeIsFailure)
52+
{
53+
this.LogErrorAndRewriteCommitGraph(activity, this.packIndexes);
54+
}
5055

5156
// Turning off Verify for commit graph due to performance issues.
5257
/*

0 commit comments

Comments
 (0)