private string[] GetPlaceholderDatabaseLinesAfterUpgradeFrom12_1(string placeholderDatabasePath) { placeholderDatabasePath.ShouldBeAFile(this.fileSystem); string[] lines = GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabasePath).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); lines.Length.ShouldEqual(9); this.PlaceholderDatabaseShouldIncludeCommonLines(lines); return(lines); }
private string[] GetPlaceholderDatabaseLinesAfterUpgradeFrom16(string placeholderDatabasePath) { placeholderDatabasePath.ShouldBeAFile(this.fileSystem); string[] lines = GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabasePath).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); lines.Length.ShouldEqual(10); this.PlaceholderDatabaseShouldIncludeCommonLines(lines); lines.ShouldContain(x => x == this.PartialFolderPlaceholderString("GVFS", "GVFS.Tests", "Properties")); return(lines); }
public void FullFilesDontAffectThePlaceholderDatabase() { string testFile = Path.Combine(this.Enlistment.RepoRoot, "FullFilesDontAffectThePlaceholderDatabase"); string placeholderDatabase = Path.Combine(this.Enlistment.DotGVFSRoot, "databases", "VFSForGit.sqlite"); string placeholdersBefore = GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabase); this.fileSystem.CreateEmptyFile(testFile); this.Enlistment.WaitForBackgroundOperations(); GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabase).ShouldEqual(placeholdersBefore); this.fileSystem.DeleteFile(testFile); this.Enlistment.WaitForBackgroundOperations(); GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabase).ShouldEqual(placeholdersBefore); }
public void MountUpgradesPlaceholderListDatabaseToSQLite() { this.Enlistment.UnmountGVFS(); this.fileSystem.DeleteFile(Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.VFSForGit)); this.WriteOldPlaceholderListDatabase(); GVFSHelpers.SaveDiskLayoutVersion(this.Enlistment.DotGVFSRoot, "18", "0"); this.Enlistment.MountGVFS(); this.Enlistment.UnmountGVFS(); // Validate the placeholders are in the SQLite placeholder database now string placeholderDatabasePath = Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.VFSForGit); placeholderDatabasePath.ShouldBeAFile(this.fileSystem); string[] lines = GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabasePath).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); lines.Length.ShouldEqual(10); this.PlaceholderDatabaseShouldIncludeCommonLines(lines); lines.ShouldContain(x => x == this.PartialFolderPlaceholderString("GVFS", "GVFS.Tests", "Properties")); this.ValidatePersistedVersionMatchesCurrentVersion(); }
public void CheckoutCleansUpTombstones() { const string folderToDelete = "Scripts"; // Delete directory to create the tombstone string directoryToDelete = this.Enlistment.GetVirtualPathTo(folderToDelete); this.fileSystem.DeleteDirectory(directoryToDelete); this.Enlistment.UnmountGVFS(); // Remove the directory entry from modified paths so git will not keep the folder up to date string modifiedPathsFile = Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.ModifiedPaths); string modifiedPathsContent = this.fileSystem.ReadAllText(modifiedPathsFile); modifiedPathsContent = string.Join(Delimiter, modifiedPathsContent.Split(new[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries).Where(x => !x.StartsWith($"A {folderToDelete}/"))); this.fileSystem.WriteAllText(modifiedPathsFile, modifiedPathsContent + Delimiter); // Add tombstone folder entry to the placeholder database so the checkout will remove the tombstone // and start projecting the folder again string placeholderDatabasePath = Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.VFSForGit); GVFSHelpers.AddPlaceholderFolder(placeholderDatabasePath, folderToDelete, TombstoneFolderPlaceholderType); this.Enlistment.MountGVFS(); directoryToDelete.ShouldNotExistOnDisk(this.fileSystem); // checkout branch to remove tombstones and project the folder again GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "checkout -f HEAD"); directoryToDelete.ShouldBeADirectory(this.fileSystem); this.Enlistment.UnmountGVFS(); string placholders = GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabasePath); placholders.ShouldNotContain(ignoreCase: false, unexpectedSubstrings: $"{folderToDelete}{GVFSHelpers.PlaceholderFieldDelimiter}{TombstoneFolderPlaceholderType}{GVFSHelpers.PlaceholderFieldDelimiter}"); }
private string[] GetPlaceholderDatabaseLines() { string placeholderDatabase = Path.Combine(this.Enlistment.DotGVFSRoot, "databases", "VFSForGit.sqlite"); return(GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabase).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)); }