Skip to content

Commit

Permalink
Merge pull request #1389: Update Git to v2.23.0
Browse files Browse the repository at this point in the history
See microsoft/git#165 for the rebase onto v2.23.0.windows.1.

This PR has a few reactions to that update:

A newline was dropped in a message. Remove it from our expectation in a test.
Rebase now has unpredictable extra line of whitespace sometimes. However, -q doesn't work in tandem with --merge, but using GIT_QUIET=true makes the output quiet on Windows. Still doesn't work on OSX for some reason, so also ignore the error output and focus on the end-result. Use git rev-parse HEAD^{tree} to ensure we got the same resulting working directory.
FileContentsShouldMatch() used to fail if both of the files didn't exist. Something changed in v2.23.0 such that a cherry-pick loses a file in both vanilla Git and VFS for Git, so the test started failing on that path. Relax the condition, since the files do match.
KnownGitCommands needs to include restore and switch, resolving #1463.
Includes the performance fix for git checkout -b from microsoft/git#183.
  • Loading branch information
derrickstolee authored Aug 22, 2019
2 parents f358148 + ae53240 commit 9b38d16
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 8 deletions.
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.20190806.1</GitPackageVersion>
<GitPackageVersion>2.20190821.4</GitPackageVersion>
</PropertyGroup>

<PropertyGroup Label="DefaultSettings">
Expand Down
9 changes: 9 additions & 0 deletions GVFS/GVFS.Common/GitCommandLineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public enum Verbs
Reset = 1 << 5,
Status = 1 << 6,
UpdateIndex = 1 << 7,
Restore = 1 << 8,
Switch = 1 << 9,
}

public bool IsValidGitCommand
Expand Down Expand Up @@ -105,6 +107,11 @@ public bool IsCheckoutWithFilePaths()
// git checkout --patch (we currently have no need to optimize this scenario)
}

if (this.IsVerb(Verbs.Restore))
{
return true;
}

return false;
}

Expand All @@ -127,8 +134,10 @@ private Verbs StringToVerbs(string verb)
case "commit": return Verbs.Commit;
case "mv": return Verbs.Move;
case "reset": return Verbs.Reset;
case "restore": return Verbs.Restore;
case "stage": return Verbs.AddOrStage;
case "status": return Verbs.Status;
case "switch": return Verbs.Switch;
case "update-index": return Verbs.UpdateIndex;
default: return Verbs.Other;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void LockToPreventUpdateAndDelete()
"modified: Test_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test.txt",
"modified: Test_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test2.txt",
"modified: Test_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test3.txt",
"Untracked files:\n (use \"git add <file>...\" to include in what will be committed)\n\n\tTest_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test_delete.txt\n\tTest_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test_delete2.txt\n\tTest_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test_delete3.txt",
"Untracked files:\n (use \"git add <file>...\" to include in what will be committed)\n\tTest_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test_delete.txt\n\tTest_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test_delete2.txt\n\tTest_EPF_UpdatePlaceholderTests/LockToPreventUpdateAndDelete/test_delete3.txt",
"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ public void ChangeBranchAndCherryPickIntoAnotherBranch()

this.ValidateGitCommand("checkout " + this.ControlGitRepo.Commitish);
this.ValidateGitCommand("checkout -b tests/functional/ChangeBranchesAndCherryPickIntoAnotherBranch_2");
this.RunGitCommand("cherry-pick DeleteForCherryPick");
this.RunGitCommand("cherry-pick -q DeleteForCherryPick");
}

[TestCase]
Expand All @@ -913,7 +913,8 @@ public void ChangeBranchAndMergeRebaseOnAnotherBranch()
this.ValidateGitCommand("add .");
this.RunGitCommand("commit -m \"Edit for ChangeBranchAndMergeRebaseOnAnotherBranch first branch\"");

this.RunGitCommand("rebase --merge tests/functional/ChangeBranchAndMergeRebaseOnAnotherBranch_1");
this.RunGitCommand("rebase --merge tests/functional/ChangeBranchAndMergeRebaseOnAnotherBranch_1", ignoreErrors: true);
this.ValidateGitCommand("rev-parse HEAD^{{tree}}");
}

[TestCase]
Expand All @@ -936,7 +937,8 @@ public void ChangeBranchAndRebaseOnAnotherBranch()
this.ValidateGitCommand("add .");
this.RunGitCommand("commit -m \"Edit for ChangeBranchAndRebaseOnAnotherBranch first branch\"");

this.ValidateGitCommand("rebase tests/functional/ChangeBranchAndRebaseOnAnotherBranch_1");
this.RunGitCommand("rebase tests/functional/ChangeBranchAndRebaseOnAnotherBranch_1", ignoreErrors: true);
this.ValidateGitCommand("rev-parse HEAD^{{tree}}");
}

[TestCase]
Expand Down
21 changes: 20 additions & 1 deletion GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitRepoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,26 @@ protected void FileContentsShouldMatch(params string[] filePathPaths)
string filePath = Path.Combine(filePathPaths);
string virtualFilePath = Path.Combine(this.Enlistment.RepoRoot, filePath);
string controlFilePath = Path.Combine(this.ControlGitRepo.RootPath, filePath);
virtualFilePath.ShouldBeAFile(this.FileSystem).WithContents(controlFilePath.ShouldBeAFile(this.FileSystem).WithContents());
bool virtualExists = File.Exists(virtualFilePath);
bool controlExists = File.Exists(controlFilePath);

if (virtualExists)
{
if (controlExists)
{
virtualFilePath.ShouldBeAFile(this.FileSystem)
.WithContents(controlFilePath.ShouldBeAFile(this.FileSystem)
.WithContents());
}
else
{
virtualExists.ShouldEqual(controlExists, $"{virtualExists} exists, but {controlExists} does not");
}
}
else if (controlExists)
{
virtualExists.ShouldEqual(controlExists, $"{virtualExists} does not exist, but {controlExists} does");
}
}

protected void FileShouldHaveCaseMatchingName(string caseSensitiveFilePath)
Expand Down
7 changes: 5 additions & 2 deletions GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ public static void ValidateGitCommand(
string controlRepoRoot = controlGitRepo.RootPath;
string gvfsRepoRoot = enlistment.RepoRoot;

ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command);
ProcessResult actualResult = GitHelpers.InvokeGitAgainstGVFSRepo(gvfsRepoRoot, command);
Dictionary<string, string> environmentVariables = new Dictionary<string, string>();
environmentVariables["GIT_QUIET"] = "true";

ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command, environmentVariables);
ProcessResult actualResult = GitHelpers.InvokeGitAgainstGVFSRepo(gvfsRepoRoot, command, environmentVariables);

ErrorsShouldMatch(command, expectedResult, actualResult);
actualResult.Output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
Expand Down
2 changes: 2 additions & 0 deletions GVFS/GVFS.Hooks/KnownGitCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ internal static class KnownGitCommands
"replace",
"rerere",
"reset",
"restore",
"rev-list",
"rev-parse",
"revert",
Expand All @@ -108,6 +109,7 @@ internal static class KnownGitCommands
"stage",
"status",
"stripspace",
"switch",
"symbolic-ref",
"tag",
"unpack-file",
Expand Down

0 comments on commit 9b38d16

Please sign in to comment.