public void WritesAfterLoad() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); alwaysExcludeFile.AddEntriesForFile("a\\1.txt"); alwaysExcludeFile.AddEntriesForFile("a\\2.txt"); List <string> expectedContents = new List <string>() { "*", "!/a/", "!/a/1.txt", "!/a/2.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); alwaysExcludeFile.LoadOrCreate(); alwaysExcludeFile.AddEntriesForFile("a\\3.txt"); expectedContents = new List <string>() { "*", "!/a/", "!/a/1.txt", "!/a/2.txt", "!/a/3.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }
public void WritesAfterLoad() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); alwaysExcludeFile.AddEntriesForFileOrFolder("A\\B", isFolder: true); alwaysExcludeFile.AddEntriesForFileOrFolder("A\\D", isFolder: true); List <string> expectedContents = new List <string>() { "*", "!/A", "!/A/B", "!/A/B/*", "!/A/D", "!/A/D/*" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); alwaysExcludeFile.LoadOrCreate(); alwaysExcludeFile.AddEntriesForFileOrFolder("a\\f", isFolder: true); expectedContents = new List <string>() { "*", "!/A", "!/A/B", "!/A/B/*", "!/A/D", "!/A/D/*", "!/a/f", "!/a/f/*" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }
public void HasDefaultEntriesAfterLoad() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); List <string> expectedContents = new List <string>() { "*" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }
public void HandlesCaseCorrectly() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); alwaysExcludeFile.AddEntriesForPath("a\\1.txt"); alwaysExcludeFile.AddEntriesForPath("A\\2.txt"); alwaysExcludeFile.AddEntriesForPath("a\\b\\1.txt"); alwaysExcludeFile.AddEntriesForPath("a\\B\\2.txt"); alwaysExcludeFile.AddEntriesForPath("A\\b\\3.txt"); alwaysExcludeFile.AddEntriesForPath("A\\B\\4.txt"); List <string> expectedContents = new List <string>() { "*", "!/a/", "!/a/1.txt", "!/A/2.txt", "!/a/b/", "!/a/b/1.txt", "!/a/B/2.txt", "!/A/b/3.txt", "!/A/B/4.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }
public void RemovesEntriesWithDifferentCase() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); alwaysExcludeFile.AddEntriesForPath("a\\x.txt"); alwaysExcludeFile.AddEntriesForPath("A\\y.txt"); alwaysExcludeFile.AddEntriesForPath("a\\Z.txt"); alwaysExcludeFile.RemoveEntriesForFile("a\\y.txt"); alwaysExcludeFile.RemoveEntriesForFile("a\\z.txt"); alwaysExcludeFile.FlushAndClose(); List <string> expectedContents = new List <string>() { "*", "!/a/", "!/a/x.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }