diff --git a/GVFS/GVFS.Build/GVFS.props b/GVFS/GVFS.Build/GVFS.props index 14173fa84b..4595a6ecac 100644 --- a/GVFS/GVFS.Build/GVFS.props +++ b/GVFS/GVFS.Build/GVFS.props @@ -3,7 +3,7 @@ 0.2.173.2 - 2.20190806.1 + 2.20190821.4 diff --git a/GVFS/GVFS.Common/GitCommandLineParser.cs b/GVFS/GVFS.Common/GitCommandLineParser.cs index b4d7119f23..ec7f6672e5 100644 --- a/GVFS/GVFS.Common/GitCommandLineParser.cs +++ b/GVFS/GVFS.Common/GitCommandLineParser.cs @@ -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 @@ -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; } @@ -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; } diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs b/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs index 94c602a271..7a9c5524ad 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs +++ b/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs @@ -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 ...\" 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 ...\" 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"); } diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs index b83db0d344..ff337045f6 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs @@ -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] @@ -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] @@ -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] diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitRepoTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitRepoTests.cs index 0acf77a910..c508e98735 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitRepoTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitRepoTests.cs @@ -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) diff --git a/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs b/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs index d6a7361429..90b00c5c06 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs @@ -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 environmentVariables = new Dictionary(); + 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) diff --git a/GVFS/GVFS.Hooks/KnownGitCommands.cs b/GVFS/GVFS.Hooks/KnownGitCommands.cs index cbf9f2165f..a392eace3c 100644 --- a/GVFS/GVFS.Hooks/KnownGitCommands.cs +++ b/GVFS/GVFS.Hooks/KnownGitCommands.cs @@ -96,6 +96,7 @@ internal static class KnownGitCommands "replace", "rerere", "reset", + "restore", "rev-list", "rev-parse", "revert", @@ -108,6 +109,7 @@ internal static class KnownGitCommands "stage", "status", "stripspace", + "switch", "symbolic-ref", "tag", "unpack-file",