diff options
author | nulltoken <emeric.fermas@gmail.com> | 2011-06-26 23:12:38 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2011-06-26 23:12:38 +0400 |
commit | c0013852416b2848be1e4900c7b508eb877173f2 (patch) | |
tree | b5324a9e31203b6a8f9759df0e818b21b489ca24 | |
parent | dfb856c9f9f19fcd38209a19ae6a7a21eb161959 (diff) |
Fix issue when enumerating commits
When not explicitly set, the "Since" boundary should be "HEAD".
-rw-r--r-- | LibGit2Sharp.Tests/CommitFixture.cs | 18 | ||||
-rw-r--r-- | LibGit2Sharp/Filter.cs | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs index e85c5cca..341f19a7 100644 --- a/LibGit2Sharp.Tests/CommitFixture.cs +++ b/LibGit2Sharp.Tests/CommitFixture.cs @@ -174,10 +174,22 @@ namespace LibGit2Sharp.Tests {
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var commits = repo.Commits.QueryBy(new Filter { Since = "refs/heads/br2", Until = "refs/heads/packed-test" });
+ var commits = repo.Commits.QueryBy(new Filter { Since = "HEAD", Until = "refs/heads/br2" });
IEnumerable<string> abbrevShas = commits.Select(c => c.Id.ToString(7)).ToArray();
- CollectionAssert.AreEquivalent(new[] { "a4a7dce", "c47800c", "9fd738e" }, abbrevShas);
+ CollectionAssert.AreEquivalent(new[] { "4c062a6", "be3563a" }, abbrevShas);
+ }
+ }
+
+ [Test]
+ public void CanEnumerateUsingOneHeadAsBoundaries()
+ {
+ using (var repo = new Repository(Constants.BareTestRepoPath))
+ {
+ var commits = repo.Commits.QueryBy(new Filter { Until = "refs/heads/br2" });
+
+ IEnumerable<string> abbrevShas = commits.Select(c => c.Id.ToString(7)).ToArray();
+ CollectionAssert.AreEquivalent(new[] { "4c062a6", "be3563a" }, abbrevShas);
}
}
@@ -192,7 +204,7 @@ namespace LibGit2Sharp.Tests CollectionAssert.AreEquivalent(new[] { "a4a7dce", "c47800c", "9fd738e" }, abbrevShas);
}
}
-
+
[Test]
public void CanLookupCommitGeneric()
{
diff --git a/LibGit2Sharp/Filter.cs b/LibGit2Sharp/Filter.cs index 6e42ea47..5985ddf3 100644 --- a/LibGit2Sharp/Filter.cs +++ b/LibGit2Sharp/Filter.cs @@ -11,6 +11,7 @@ public Filter() { SortBy = GitSortOptions.Time; + Since = "HEAD"; } /// <summary> |