Skip to content

Commit 2f1bd65

Browse files
committed
Fix GetHeadTreeId to only read head commit
The previous implementation of GetHeadTreeId called "git show -s". "-s" suppresses the diff from the output, but it turns out git still performs the diff operation internally. The inefficiency isn't necessarily an issue, but we are running git.exe with the virtualization hook off so if the objects required for the diff are not already downloaded the command will fail. The new implementation produces the same output, but doesn't try to do a diff at all.
1 parent f877d10 commit 2f1bd65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

GVFS/GVFS.Common/Git/GitProcess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ public Result MultiPackIndexRepack(string gitObjectDirectory, string batchSize)
684684

685685
public Result GetHeadTreeId()
686686
{
687-
return this.InvokeGitAgainstDotGitFolder("show -s --format=%T HEAD", usePreCommandHook: false);
687+
return this.InvokeGitAgainstDotGitFolder("rev-parse \"HEAD^{tree}\"", usePreCommandHook: false);
688688
}
689689

690690
public Process GetGitProcess(string command, string workingDirectory, string dotGitDirectory, bool useReadObjectHook, bool redirectStandardError, string gitObjectsDirectory, bool usePreCommandHook)

0 commit comments

Comments
 (0)