diff --git a/GVFS/GVFS.Common/Prefetch/Git/GitIndexGenerator.cs b/GVFS/GVFS.Common/Prefetch/Git/GitIndexGenerator.cs index 3bc66f07c..66ae2d3d9 100644 --- a/GVFS/GVFS.Common/Prefetch/Git/GitIndexGenerator.cs +++ b/GVFS/GVFS.Common/Prefetch/Git/GitIndexGenerator.cs @@ -60,11 +60,11 @@ public GitIndexGenerator(ITracer tracer, Enlistment enlistment, bool shouldHashI public bool HasFailures { get; private set; } - public void CreateFromHeadTree(uint indexVersion, HashSet sparseCheckoutEntries = null) + public void CreateFromHeadTree(uint indexVersion) { using (ITracer updateIndexActivity = this.tracer.StartActivity("CreateFromHeadTree", EventLevel.Informational)) { - Thread entryWritingThread = new Thread(() => this.WriteAllEntries(indexVersion, sparseCheckoutEntries)); + Thread entryWritingThread = new Thread(() => this.WriteAllEntries(indexVersion)); entryWritingThread.Start(); GitProcess git = new GitProcess(this.enlistment); @@ -94,7 +94,7 @@ private void EnqueueEntriesFromLsTree(string line) } } - private void WriteAllEntries(uint version, HashSet sparseCheckoutEntries) + private void WriteAllEntries(uint version) { try { @@ -109,11 +109,7 @@ private void WriteAllEntries(uint version, HashSet sparseCheckoutEntries LsTreeEntry entry; while (this.entryQueue.TryTake(out entry, Timeout.Infinite)) { - bool skipWorkTree = - sparseCheckoutEntries != null && - !sparseCheckoutEntries.Contains(entry.Filename) && - !sparseCheckoutEntries.Contains(this.GetDirectoryNameForGitPath(entry.Filename)); - this.WriteEntry(writer, version, entry.Sha, entry.Filename, skipWorkTree, ref lastStringLength); + this.WriteEntry(writer, version, entry.Sha, entry.Filename, ref lastStringLength); } // Update entry count @@ -143,7 +139,7 @@ private string GetDirectoryNameForGitPath(string filename) return filename.Substring(0, idx + 1); } - private void WriteEntry(BinaryWriter writer, uint version, string sha, string filename, bool skipWorktree, ref uint lastStringLength) + private void WriteEntry(BinaryWriter writer, uint version, string sha, string filename, ref uint lastStringLength) { long startPosition = writer.BaseStream.Position; @@ -156,14 +152,8 @@ private void WriteEntry(BinaryWriter writer, uint version, string sha, string fi byte[] filenameBytes = Encoding.UTF8.GetBytes(filename); ushort flags = (ushort)(filenameBytes.Length & 0xFFF); - flags |= version >= 3 && skipWorktree ? ExtendedBit : (ushort)0; writer.Write(EndianHelper.Swap(flags)); - if (version >= 3 && skipWorktree) - { - writer.Write(EndianHelper.Swap(SkipWorktreeBit)); - } - if (version >= 4) { this.WriteReplaceLength(writer, lastStringLength); diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/DiskLayoutUpgradeTests.cs b/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/DiskLayoutUpgradeTests.cs index 1abbbaafb..d3ea1f93b 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/DiskLayoutUpgradeTests.cs +++ b/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/DiskLayoutUpgradeTests.cs @@ -27,6 +27,17 @@ public class DiskLayoutUpgradeTests : TestsWithEnlistmentPerTestCase private FileSystemRunner fileSystem = new SystemIORunner(); + [SetUp] + public override void CreateEnlistment() + { + base.CreateEnlistment(); + + // Since there isn't a sparse-checkout file that is used anymore one needs to be added + // in order to test the old upgrades that might have needed it + string sparseCheckoutPath = Path.Combine(this.Enlistment.RepoRoot, TestConstants.DotGit.Info.SparseCheckoutPath); + this.fileSystem.WriteAllText(sparseCheckoutPath, "/.gitattributes\r\n"); + } + [TestCase] public void MountUpgradesFromVersion7() { diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs b/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs index f113b0012..5d6acf516 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs +++ b/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs @@ -48,6 +48,11 @@ public void MountUpgradesLocalSizesToSharedCache() versionJsonPath.ShouldBeAFile(this.fileSystem); this.fileSystem.DeleteFile(versionJsonPath); + // Since there isn't a sparse-checkout file that is used anymore one needs to be added + // in order to test the old upgrades that might have needed it + string sparseCheckoutPath = Path.Combine(enlistment.RepoRoot, TestConstants.DotGit.Info.SparseCheckoutPath); + this.fileSystem.WriteAllText(sparseCheckoutPath, "/.gitattributes\r\n"); + // "13.0" was the last version before blob sizes were moved out of Esent string metadataPath = Path.Combine(enlistment.DotGVFSRoot, GVFSHelpers.RepoMetadataName); this.fileSystem.CreateEmptyFile(metadataPath); @@ -103,6 +108,11 @@ public void MountUpgradesLocalSizesToSharedCache() versionJsonPath.ShouldBeAFile(this.fileSystem); this.fileSystem.DeleteFile(versionJsonPath); + // Since there isn't a sparse-checkout file that is used anymore one needs to be added + // in order to test the old upgrades that might have needed it + string sparseCheckoutPath2 = Path.Combine(enlistment2.RepoRoot, TestConstants.DotGit.Info.SparseCheckoutPath); + this.fileSystem.WriteAllText(sparseCheckoutPath2, "/.gitattributes\r\n"); + // "13.0" was the last version before blob sizes were moved out of Esent metadataPath = Path.Combine(enlistment2.DotGVFSRoot, GVFSHelpers.RepoMetadataName); this.fileSystem.CreateEmptyFile(metadataPath); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs index 1fc03382b..9c51fefcc 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs @@ -65,10 +65,7 @@ public void DehydrateShouldBackupFiles() // .git folder items string gitFolder = Path.Combine(backupFolderItems[0], ".git"); - this.DirectoryShouldContain(gitFolder, "index", "info"); - - string gitInfoFolder = Path.Combine(gitFolder, "info"); - this.DirectoryShouldContain(gitInfoFolder, "sparse-checkout"); + this.DirectoryShouldContain(gitFolder, "index"); // .gvfs folder items string gvfsFolder = Path.Combine(backupFolderItems[0], ".gvfs"); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs index d1b56fc48..3100e7ad0 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs @@ -141,7 +141,7 @@ public void RenameFolderTest() [TestCase, Order(6)] [Category(Categories.MacTODO.M2)] - public void CaseOnlyRenameOfNewFolderKeepsExcludeEntries() + public void CaseOnlyRenameOfNewFolderKeepsModifiedPathsEntries() { string[] expectedModifiedPathsEntries = { @@ -162,7 +162,7 @@ public void CaseOnlyRenameOfNewFolderKeepsExcludeEntries() } [TestCase, Order(7)] - public void ReadingFileDoesNotUpdateIndexOrSparseCheckout() + public void ReadingFileDoesNotUpdateIndexOrModifiedPaths() { string gitFileToCheck = "GVFS/GVFS.FunctionalTests/Category/CategoryConstants.cs"; string virtualFile = this.Enlistment.GetVirtualPathTo(gitFileToCheck); @@ -296,13 +296,13 @@ public void DeletedFolderAndChildrenAddedToToModifiedPathsFile() } [TestCase, Order(13)] - public void FileRenamedOutOfRepoAddedToModifiedPathsFile() + public void FileRenamedOutOfRepoAddedToModifiedPathsAndSkipWorktreeBitCleared() { string fileToRenameEntry = "GVFlt_MoveFileTest/PartialToOutside/from/lessInFrom.txt"; string fileToRenameVirtualPath = this.Enlistment.GetVirtualPathTo(fileToRenameEntry); this.VerifyWorktreeBit(fileToRenameEntry, LsFilesStatus.SkipWorktree); - string fileOutsideRepoPath = Path.Combine(this.Enlistment.EnlistmentRoot, "FileRenamedOutOfRepoAddedToSparseCheckoutAndSkipWorktreeBitCleared.txt"); + string fileOutsideRepoPath = Path.Combine(this.Enlistment.EnlistmentRoot, $"{nameof(this.FileRenamedOutOfRepoAddedToModifiedPathsAndSkipWorktreeBitCleared)}.txt"); this.fileSystem.MoveFile(fileToRenameVirtualPath, fileOutsideRepoPath); fileOutsideRepoPath.ShouldBeAFile(this.fileSystem).WithContents("lessData"); @@ -315,13 +315,13 @@ public void FileRenamedOutOfRepoAddedToModifiedPathsFile() } [TestCase, Order(14)] - public void OverwrittenFileAddedToSparseCheckoutAndSkipWorktreeBitCleared() + public void OverwrittenFileAddedToModifiedPathsAndSkipWorktreeBitCleared() { string fileToOverwriteEntry = "Test_EPF_WorkingDirectoryTests/1/2/3/4/ReadDeepProjectedFile.cpp"; string fileToOverwriteVirtualPath = this.Enlistment.GetVirtualPathTo(fileToOverwriteEntry); this.VerifyWorktreeBit(fileToOverwriteEntry, LsFilesStatus.SkipWorktree); - string testContents = "Test contents for FileRenamedOutOfRepoWillBeAddedToSparseCheckoutAndHaveSkipWorktreeBitCleared"; + string testContents = $"Test contents for {nameof(this.OverwrittenFileAddedToModifiedPathsAndSkipWorktreeBitCleared)}"; this.fileSystem.WriteAllText(fileToOverwriteVirtualPath, testContents); this.Enlistment.WaitForBackgroundOperations().ShouldEqual(true, "Background operations failed to complete."); @@ -336,13 +336,13 @@ public void OverwrittenFileAddedToSparseCheckoutAndSkipWorktreeBitCleared() [TestCase, Order(15)] [Category(Categories.MacTODO.M2)] - public void SupersededFileAddedToSparseCheckoutAndSkipWorktreeBitCleared() + public void SupersededFileAddedToModifiedPathsAndSkipWorktreeBitCleared() { string fileToSupersedeEntry = "GVFlt_FileOperationTest/WriteAndVerify.txt"; string fileToSupersedePath = this.Enlistment.GetVirtualPathTo("GVFlt_FileOperationTest\\WriteAndVerify.txt"); this.VerifyWorktreeBit(fileToSupersedeEntry, LsFilesStatus.SkipWorktree); - string newContent = "SupersededFileWillBeAddedToSparseCheckoutAndHaveSkipWorktreeBitCleared test new contents"; + string newContent = $"{nameof(this.SupersededFileAddedToModifiedPathsAndSkipWorktreeBitCleared)} test new contents"; SupersedeFile(fileToSupersedePath, newContent).ShouldEqual(true); this.Enlistment.WaitForBackgroundOperations().ShouldEqual(true, "Background operations failed to complete."); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs index d5088205e..7dd6dd41b 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs @@ -430,7 +430,7 @@ public void FolderContentsCorrectAfterCreateNewFolderRenameAndCheckoutCommitWith folder.ShouldNotExistOnDisk(this.fileSystem); GVFSHelpers.ModifiedPathsShouldNotContain(this.fileSystem, this.Enlistment.DotGVFSRoot, folderName); - // Confirm sparse-checkout picks up renamed folder + // Confirm modified paths picks up renamed folder string newFolder = this.Enlistment.GetVirtualPathTo("newFolder"); this.fileSystem.CreateDirectory(newFolder); this.fileSystem.MoveDirectory(newFolder, folder); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs index 53a655a54..3e9a65187 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs @@ -3,9 +3,7 @@ using GVFS.FunctionalTests.Tools; using GVFS.Tests.Should; using NUnit.Framework; -using System; using System.IO; -using System.Linq; using System.Runtime.InteropServices; namespace GVFS.FunctionalTests.Tests.EnlistmentPerTestCase @@ -18,33 +16,33 @@ public class ModifiedPathsTests : TestsWithEnlistmentPerTestCase private static readonly string FileToDelete = "Readme.md"; private static readonly string FileToRename = Path.Combine("GVFS", "GVFS.Mount", "MountVerb.cs"); private static readonly string RenameFileTarget = Path.Combine("GVFS", "GVFS.Mount", "MountVerb2.cs"); - private static readonly string FolderToCreate = "PersistedSparseExcludeTests_NewFolder"; - private static readonly string FolderToRename = "PersistedSparseExcludeTests_NewFolderForRename"; - private static readonly string RenameFolderTarget = "PersistedSparseExcludeTests_NewFolderForRename2"; + private static readonly string FolderToCreate = $"{nameof(ModifiedPathsTests)}_NewFolder"; + private static readonly string FolderToRename = $"{nameof(ModifiedPathsTests)}_NewFolderForRename"; + private static readonly string RenameFolderTarget = $"{nameof(ModifiedPathsTests)}_NewFolderForRename2"; private static readonly string DotGitFileToCreate = Path.Combine(".git", "TestFileFromDotGit.txt"); private static readonly string RenameNewDotGitFileTarget = "TestFileFromDotGit.txt"; - private static readonly string FileToCreateOutsideRepo = "PersistedSparseExcludeTests_outsideRepo.txt"; - private static readonly string FolderToCreateOutsideRepo = "PersistedSparseExcludeTests_outsideFolder"; + private static readonly string FileToCreateOutsideRepo = $"{nameof(ModifiedPathsTests)}_outsideRepo.txt"; + private static readonly string FolderToCreateOutsideRepo = $"{nameof(ModifiedPathsTests)}_outsideFolder"; private static readonly string FolderToDelete = "Scripts"; - private static readonly string ExpectedModifiedFilesContentsAfterRemount = -@"A .gitattributes -A GVFS/TestAddFile.txt -A GVFS/GVFS/Program.cs -A Readme.md -A GVFS/GVFS.Mount/MountVerb.cs -A GVFS/GVFS.Mount/MountVerb2.cs -A PersistedSparseExcludeTests_NewFolder/ -A PersistedSparseExcludeTests_NewFolderForRename/ -A PersistedSparseExcludeTests_NewFolderForRename2/ -A TestFileFromDotGit.txt -A PersistedSparseExcludeTests_outsideRepo.txt -A PersistedSparseExcludeTests_outsideFolder/ -A Scripts/CreateCommonAssemblyVersion.bat -A Scripts/CreateCommonCliAssemblyVersion.bat -A Scripts/CreateCommonVersionHeader.bat -A Scripts/RunFunctionalTests.bat -A Scripts/RunUnitTests.bat -A Scripts/ + private static readonly string ExpectedModifiedFilesContentsAfterRemount = +$@"A .gitattributes +A {GVFSHelpers.ConvertPathToGitFormat(FileToAdd)} +A {GVFSHelpers.ConvertPathToGitFormat(FileToUpdate)} +A {FileToDelete} +A {GVFSHelpers.ConvertPathToGitFormat(FileToRename)} +A {GVFSHelpers.ConvertPathToGitFormat(RenameFileTarget)} +A {FolderToCreate}/ +A {FolderToRename}/ +A {RenameFolderTarget}/ +A {RenameNewDotGitFileTarget} +A {FileToCreateOutsideRepo} +A {FolderToCreateOutsideRepo}/ +A {FolderToDelete}/CreateCommonAssemblyVersion.bat +A {FolderToDelete}/CreateCommonCliAssemblyVersion.bat +A {FolderToDelete}/CreateCommonVersionHeader.bat +A {FolderToDelete}/RunFunctionalTests.bat +A {FolderToDelete}/RunUnitTests.bat +A {FolderToDelete}/ "; [Category(Categories.MacTODO.M2)] @@ -72,14 +70,14 @@ public void ModifiedPathsSavedAfterRemount(FileSystemRunner fileSystem) string folderToRenameTarget = this.Enlistment.GetVirtualPathTo(RenameFolderTarget); fileSystem.MoveDirectory(folderToRename, folderToRenameTarget); - // Moving the new folder out of the repo should not change the always_exclude file + // Moving the new folder out of the repo should not change the modified paths string folderTargetOutsideSrc = Path.Combine(this.Enlistment.EnlistmentRoot, RenameFolderTarget); folderTargetOutsideSrc.ShouldNotExistOnDisk(fileSystem); fileSystem.MoveDirectory(folderToRenameTarget, folderTargetOutsideSrc); folderTargetOutsideSrc.ShouldBeADirectory(fileSystem); folderToRenameTarget.ShouldNotExistOnDisk(fileSystem); - // Moving a file from the .git folder to the working directory should add the file to the sparse-checkout + // Moving a file from the .git folder to the working directory should add the file to the modified paths string dotGitfileToAdd = this.Enlistment.GetVirtualPathTo(DotGitFileToCreate); fileSystem.WriteAllText(dotGitfileToAdd, "Contents for the new file in dot git"); fileSystem.MoveFile(dotGitfileToAdd, this.Enlistment.GetVirtualPathTo(RenameNewDotGitFileTarget)); diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs index 0fb311fc6..30f0f02bc 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs @@ -823,7 +823,7 @@ public void DeleteFileThenCheckout() [Category(Categories.MacTODO.M3)] public void CheckoutEditCheckoutWithoutFolderThenCheckoutWithMultipleFiles() { - // Edit the file to get the entry in the sparse-checkout file + // Edit the file to get the entry in the modified paths database this.EditFile("Changing the content of one file", "DeleteFileWithNameAheadOfDotAndSwitchCommits", "1"); this.RunGitCommand("reset --hard -q HEAD"); diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/UpdateIndexTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/UpdateIndexTests.cs index 943e54abb..5ca28eaa4 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/UpdateIndexTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/UpdateIndexTests.cs @@ -52,7 +52,7 @@ public void UpdateIndexRemoveAddFileOpenForWrite() GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "update-index --remove Test_ConflictTests/AddedFiles/AddedByBothDifferentContent.txt"); this.FilesShouldMatchCheckoutOfTargetBranch(); - // Open Test_ConflictTests/AddedFiles/AddedByBothDifferentContent.txt for write so that it's added to the sparse-checkout + // Open Test_ConflictTests/AddedFiles/AddedByBothDifferentContent.txt for write so that it's added to the modified paths database using (FileStream stream = File.Open(Path.Combine(this.Enlistment.RepoRoot, @"Test_ConflictTests\AddedFiles\AddedByBothDifferentContent.txt"), FileMode.Open, FileAccess.Write)) { // TODO 940287: Remove this File.Open once update-index --add\--remove are working as expected diff --git a/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs b/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs index 139fb0a06..95e988c18 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs @@ -23,7 +23,12 @@ public static class GVFSHelpers private const string DiskLayoutMinorVersionKey = "DiskLayoutMinorVersion"; private const string LocalCacheRootKey = "LocalCacheRoot"; private const string GitObjectsRootKey = "GitObjectsRoot"; - private const string BlobSizesRootKey = "BlobSizesRoot"; + private const string BlobSizesRootKey = "BlobSizesRoot"; + + public static string ConvertPathToGitFormat(string path) + { + return path.Replace(Path.DirectorySeparatorChar, TestConstants.GitPathSeparator); + } public static void SaveDiskLayoutVersion(string dotGVFSRoot, string majorVersion, string minorVersion) { diff --git a/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs b/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs index 729d1d700..333499ba0 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs @@ -12,8 +12,6 @@ namespace GVFS.FunctionalTests.Tools { public static class GitHelpers { - public const string AlwaysExcludeFilePath = @".git\info\always_exclude"; - /// /// This string must match the command name provided in the /// GVFS.FunctionalTests.LockHolder program. diff --git a/GVFS/GVFS.FunctionalTests/Tools/TestConstants.cs b/GVFS/GVFS.FunctionalTests/Tools/TestConstants.cs index ebc6ee28f..0bf84a1b1 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/TestConstants.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/TestConstants.cs @@ -6,6 +6,7 @@ public static class TestConstants { public const string AllZeroSha = "0000000000000000000000000000000000000000"; public const string PartialFolderPlaceholderDatabaseValue = " PARTIAL FOLDER"; + public const char GitPathSeparator = '/'; public static class DotGit { diff --git a/GVFS/GVFS.Virtualization/FileSystemCallbacks.cs b/GVFS/GVFS.Virtualization/FileSystemCallbacks.cs index ce1b8afe4..a9ea5200e 100644 --- a/GVFS/GVFS.Virtualization/FileSystemCallbacks.cs +++ b/GVFS/GVFS.Virtualization/FileSystemCallbacks.cs @@ -705,7 +705,7 @@ private FileSystemTaskResult ExecuteBackgroundOperation(FileSystemTask gitUpdate exceptionMetadata.Add("virtualPath", gitUpdate.VirtualPath); exceptionMetadata.Add(TracingConstants.MessageKey.InfoMessage, "DirectoryNotFoundException while traversing folder path"); exceptionMetadata.Add("folderPath", folderPath); - this.context.Tracer.RelatedEvent(EventLevel.Informational, "DirectoryNotFoundWhileUpdatingAlwaysExclude", exceptionMetadata); + this.context.Tracer.RelatedEvent(EventLevel.Informational, "DirectoryNotFoundWhileUpdatingModifiedPaths", exceptionMetadata); } catch (IOException e) { diff --git a/GVFS/GVFS.Virtualization/Projection/GitIndexProjection.cs b/GVFS/GVFS.Virtualization/Projection/GitIndexProjection.cs index ba40f28b6..66b139615 100644 --- a/GVFS/GVFS.Virtualization/Projection/GitIndexProjection.cs +++ b/GVFS/GVFS.Virtualization/Projection/GitIndexProjection.cs @@ -1607,7 +1607,7 @@ private void ProcessGvUpdateDeletePlaceholderResult( // update in the working directory will be full files but we will have a placeholder entry for them as well. // There have been reports of FileSystemVirtualizationInvalidOperation getting hit without a corresponding background - // task having been scheduled (to add the file to the sparse-checkout and clear the skip-worktree bit). + // task having been scheduled (to add the file to the modified paths). // Schedule OnFailedPlaceholderUpdate\OnFailedPlaceholderDelete to be sure that Git starts managing this // file. Currently the only known way that this can happen is deleting a partial file and putting a full // file in its place while GVFS is unmounted. diff --git a/GVFS/GVFS/CommandLine/CloneVerb.cs b/GVFS/GVFS/CommandLine/CloneVerb.cs index 376e0f2a0..00a429c07 100644 --- a/GVFS/GVFS/CommandLine/CloneVerb.cs +++ b/GVFS/GVFS/CommandLine/CloneVerb.cs @@ -552,10 +552,6 @@ private Result CreateClone( Path.Combine(enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Head), "ref: refs/heads/" + branch); - File.AppendAllText( - Path.Combine(enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Info.SparseCheckoutPath), - GVFSConstants.GitPathSeparatorString + GVFSConstants.SpecialGitFiles.GitAttributes + "\n"); - if (!this.TryDownloadRootGitAttributes(enlistment, gitObjects, gitRepo, out errorMessage)) { return new Result(errorMessage); diff --git a/GVFS/GVFS/CommandLine/DehydrateVerb.cs b/GVFS/GVFS/CommandLine/DehydrateVerb.cs index 39100557a..71342283a 100644 --- a/GVFS/GVFS/CommandLine/DehydrateVerb.cs +++ b/GVFS/GVFS/CommandLine/DehydrateVerb.cs @@ -232,7 +232,6 @@ private bool TryBackupFiles(ITracer tracer, GVFSEnlistment enlistment, string ba { string backupSrc = Path.Combine(backupRoot, "src"); string backupGit = Path.Combine(backupRoot, ".git"); - string backupInfo = Path.Combine(backupGit, GVFSConstants.DotGit.Info.Name); string backupGvfs = Path.Combine(backupRoot, ".gvfs"); string backupDatabases = Path.Combine(backupGvfs, GVFSConstants.DotGVFS.Databases.Name); @@ -243,7 +242,6 @@ private bool TryBackupFiles(ITracer tracer, GVFSEnlistment enlistment, string ba string ioError; if (!this.TryIO(tracer, () => Directory.CreateDirectory(backupRoot), "Create backup directory", out ioError) || !this.TryIO(tracer, () => Directory.CreateDirectory(backupGit), "Create backup .git directory", out ioError) || - !this.TryIO(tracer, () => Directory.CreateDirectory(backupInfo), "Create backup .git\\info directory", out ioError) || !this.TryIO(tracer, () => Directory.CreateDirectory(backupGvfs), "Create backup .gvfs directory", out ioError) || !this.TryIO(tracer, () => Directory.CreateDirectory(backupDatabases), "Create backup .gvfs databases directory", out ioError)) { @@ -266,43 +264,6 @@ private bool TryBackupFiles(ITracer tracer, GVFSEnlistment enlistment, string ba return false; } - // ... but then move the hydration-related files back to the backup... - if (!this.TryIO( - tracer, - () => File.Move( - Path.Combine(enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Info.SparseCheckoutPath), - Path.Combine(backupInfo, GVFSConstants.DotGit.Info.SparseCheckoutName)), - "Backup the sparse-checkout file", - out errorMessage) || - !this.TryIO( - tracer, - () => - { - if (File.Exists(Path.Combine(enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Info.AlwaysExcludePath))) - { - File.Move( - Path.Combine(enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Info.AlwaysExcludePath), - Path.Combine(backupInfo, GVFSConstants.DotGit.Info.AlwaysExcludeName)); - } - }, - "Backup the always_exclude file", - out errorMessage)) - { - return false; - } - - // ... and recreate empty ones in the new .git folder... - if (!this.TryIO( - tracer, - () => File.AppendAllText( - Path.Combine(enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Info.SparseCheckoutPath), - GVFSConstants.GitPathSeparatorString + GVFSConstants.SpecialGitFiles.GitAttributes + "\n"), - "Recreate a new sparse-checkout file", - out errorMessage)) - { - return false; - } - // ... backup the .gvfs hydration-related data structures... string databasesFolder = Path.Combine(enlistment.DotGVFSRoot, GVFSConstants.DotGVFS.Databases.Name); if (!TryBackupFilesInFolder(tracer, databasesFolder, backupDatabases, searchPattern: "*", filenamesToSkip: "RepoMetadata.dat")) @@ -419,7 +380,7 @@ private bool TryRecreateIndex(ITracer tracer, GVFSEnlistment enlistment) if (!this.ShowStatusWhileRunning( () => { - // Create a new index based on the new minimal sparse-checkout + // Create a new index based on the new minimal modified paths using (NamedPipeServer pipeServer = AllowAllLocksNamedPipeServer.Create(tracer, enlistment)) { GitProcess git = new GitProcess(enlistment); diff --git a/GVFS/GVFS/CommandLine/GVFSVerb.cs b/GVFS/GVFS/CommandLine/GVFSVerb.cs index dbb9440d6..325e2dcee 100644 --- a/GVFS/GVFS/CommandLine/GVFSVerb.cs +++ b/GVFS/GVFS/CommandLine/GVFSVerb.cs @@ -84,7 +84,6 @@ public static bool TrySetRequiredGitConfigSettings(Enlistment enlistment) { "core.midx", "true" }, { "core.preloadIndex", "true" }, { "core.safecrlf", "false" }, - { "core.sparseCheckout", "true" }, { "core.untrackedCache", "false" }, { "core.repositoryformatversion", "0" }, { "core.filemode", "false" }, diff --git a/GVFS/GVFS/RepairJobs/GitIndexRepairJob.cs b/GVFS/GVFS/RepairJobs/GitIndexRepairJob.cs index f6cb9f547..ce41ed125 100644 --- a/GVFS/GVFS/RepairJobs/GitIndexRepairJob.cs +++ b/GVFS/GVFS/RepairJobs/GitIndexRepairJob.cs @@ -9,13 +9,11 @@ namespace GVFS.RepairJobs public class GitIndexRepairJob : RepairJob { private readonly string indexPath; - private readonly string sparseCheckoutPath; public GitIndexRepairJob(ITracer tracer, TextWriter output, GVFSEnlistment enlistment) : base(tracer, output, enlistment) { this.indexPath = Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName); - this.sparseCheckoutPath = Path.Combine(this.Enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Info.SparseCheckoutPath); } public override string Name