diff --git a/GitTfsTest/Integration/CloneTests.cs b/GitTfsTest/Integration/CloneTests.cs index 08aac71e..614463f0 100644 --- a/GitTfsTest/Integration/CloneTests.cs +++ b/GitTfsTest/Integration/CloneTests.cs @@ -195,5 +195,24 @@ namespace Sep.Git.Tfs.Test.Integration h.AssertRef("MyProject", "refs/remotes/tfs/Branch", expectedShaBranch); h.AssertFileInWorkspace("MyProject", "File.txt", "File contents_main_branch=>_merge"); } + + #region ignore regexes + + [FactExceptOnUnix] + public void IgnoresAFile() + { + h.SetupFake(r => + { + r.Changeset(1, "Project created from template", DateTime.Parse("2012-01-01 12:12:12 -05:00")) + .Change(TfsChangeType.Add, TfsItemType.Folder, "$/MyProject"); + r.Changeset(2, "Add some files", DateTime.Parse("2012-01-02 12:12:12 -05:00")) + .Change(TfsChangeType.Edit, TfsItemType.File, "$/MyProject/README", "tldr\nanother line\n") + .Change(TfsChangeType.Add, TfsItemType.File, "$/MyProject/app.exe", "Do not include"); + }); + h.Run("clone", h.TfsUrl, "$/MyProject", "MyProject", "--ignore-regex=.exe$"); + h.AssertNoFileInWorkspace("MyProject", "app.exe"); + } + + #endregion } } diff --git a/GitTfsTest/Integration/IntegrationHelper.cs b/GitTfsTest/Integration/IntegrationHelper.cs index 3e7d72f9..8fae26b3 100644 --- a/GitTfsTest/Integration/IntegrationHelper.cs +++ b/GitTfsTest/Integration/IntegrationHelper.cs @@ -271,8 +271,7 @@ namespace Sep.Git.Tfs.Test.Integration public int GetCommitCount(string repodir) { - var repo = new LibGit2Sharp.Repository(Path.Combine(Workdir, repodir)); - return repo.Commits.Count(); + return Repository(repodir).Commits.Count(); } public void AssertGitRepo(string repodir) @@ -324,6 +323,12 @@ namespace Sep.Git.Tfs.Test.Integration AssertEqual(contents, actual, "Contents of " + path); } + public void AssertNoFileInWorkspace(string repodir, string file) + { + var path = Path.Combine(Workdir, repodir, file); + Assert.False(File.Exists(path), "Expect " + file + " to be absent from " + repodir); + } + public void AssertCommitMessage(string repodir, string commitish, string message) { var commit = Repository(repodir).Lookup(commitish);