public void ModifiedPathsFromChangesInsideRepoSavedAfterRemount(FileSystemRunner fileSystem) { 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 {RenameNewDotGitFileTarget}", $"A {FolderToDelete}/", }; string fileToAdd = this.Enlistment.GetVirtualPathTo(FileToAdd); fileSystem.WriteAllText(fileToAdd, "Contents for the new file"); string fileToUpdate = this.Enlistment.GetVirtualPathTo(FileToUpdate); fileSystem.AppendAllText(fileToUpdate, "// Testing"); string fileToDelete = this.Enlistment.GetVirtualPathTo(FileToDelete); fileSystem.DeleteFile(fileToDelete); fileToDelete.ShouldNotExistOnDisk(fileSystem); string fileToRename = this.Enlistment.GetVirtualPathTo(FileToRename); fileSystem.MoveFile(fileToRename, this.Enlistment.GetVirtualPathTo(RenameFileTarget)); string folderToCreate = this.Enlistment.GetVirtualPathTo(FolderToCreate); fileSystem.CreateDirectory(folderToCreate); string folderToRename = this.Enlistment.GetVirtualPathTo(FolderToRename); fileSystem.CreateDirectory(folderToRename); string folderToRenameTarget = this.Enlistment.GetVirtualPathTo(RenameFolderTarget); fileSystem.MoveDirectory(folderToRename, folderToRenameTarget); // Deleting the new folder will remove it from the modified paths file fileSystem.DeleteDirectory(folderToRenameTarget); folderToRenameTarget.ShouldNotExistOnDisk(fileSystem); // 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)); string folderToDeleteFullPath = this.Enlistment.GetVirtualPathTo(FolderToDelete); fileSystem.WriteAllText(Path.Combine(folderToDeleteFullPath, "NewFile.txt"), "Contents for new file"); string newFileToDelete = Path.Combine(folderToDeleteFullPath, "NewFileToDelete.txt"); fileSystem.WriteAllText(newFileToDelete, "Contents for new file"); fileSystem.DeleteFile(newFileToDelete); fileSystem.WriteAllText(Path.Combine(folderToDeleteFullPath, "CreateCommonVersionHeader.bat"), "Changing the file contents"); fileSystem.DeleteFile(Path.Combine(folderToDeleteFullPath, "RunUnitTests.bat")); fileSystem.DeleteDirectory(folderToDeleteFullPath); folderToDeleteFullPath.ShouldNotExistOnDisk(fileSystem); // Remount this.Enlistment.UnmountGVFS(); this.Enlistment.MountGVFS(); this.Enlistment.WaitForBackgroundOperations(); string modifiedPathsDatabase = Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.ModifiedPaths); modifiedPathsDatabase.ShouldBeAFile(fileSystem); using (StreamReader reader = new StreamReader(File.Open(modifiedPathsDatabase, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) { reader.ReadToEnd().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).OrderBy(x => x) .ShouldMatchInOrder(expectedModifiedFilesContentsAfterRemount.OrderBy(x => x)); } }