Add a test for ignore-regex.

This commit is contained in:
Matt Burke
2014-01-08 16:49:10 -05:00
parent 3a244d0db5
commit d8f05cd463
2 changed files with 26 additions and 2 deletions
+19
View File
@@ -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
}
}
+7 -2
View File
@@ -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<Commit>(commitish);