aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit_walker_test.go
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-04-10 16:48:40 +0200
committerAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-04-11 11:22:45 +0200
commitbe8d19438ada078a8598e366ab74aa09e4c521cd (patch)
treed9edb36326016ea35d38f68810e9ce70e538e7a0 /plumbing/object/commit_walker_test.go
parent3daede53835e8572b2957a016f068781db646567 (diff)
downloadgo-git-be8d19438ada078a8598e366ab74aa09e4c521cd.tar.gz
Add Repository.Log() method (fix #298)
- CommitIter is now an interface - The old CommitIter implementation is now called StorerCommitIter - CommitWalker and CommitWalkerPost are now iterators (CommitPreIterator and CommitPostIterator). - Remove Commit.History() method. There are so many ways to iterate a commit history, depending of the use case. Now, instead of use the History() method, you must use CommitPreIterator or CommitPostIterator. - Move commitSorterer to references.go because is the only place that it is used, and it must not be used into another place. - Make References method private, it must only be used into blame logic. - Added a TODO into references method, where the sortCommits is used to remove it in a near future.
Diffstat (limited to 'plumbing/object/commit_walker_test.go')
-rw-r--r--plumbing/object/commit_walker_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/plumbing/object/commit_walker_test.go b/plumbing/object/commit_walker_test.go
index aa54de0..7d04bce 100644
--- a/plumbing/object/commit_walker_test.go
+++ b/plumbing/object/commit_walker_test.go
@@ -8,11 +8,12 @@ type CommitWalkerSuite struct {
var _ = Suite(&CommitWalkerSuite{})
-func (s *CommitWalkerSuite) TestWalkHistory(c *C) {
+func (s *CommitWalkerSuite) TestCommitPreIterator(c *C) {
commit := s.commit(c, s.Fixture.Head)
var commits []*Commit
- WalkCommitHistory(commit, func(c *Commit) error {
+ wIter := NewCommitPreIterator(commit)
+ wIter.ForEach(func(c *Commit) error {
commits = append(commits, c)
return nil
})
@@ -34,11 +35,12 @@ func (s *CommitWalkerSuite) TestWalkHistory(c *C) {
}
}
-func (s *CommitWalkerSuite) TestWalkHistoryPost(c *C) {
+func (s *CommitWalkerSuite) TestCommitPostIterator(c *C) {
commit := s.commit(c, s.Fixture.Head)
var commits []*Commit
- WalkCommitHistoryPost(commit, func(c *Commit) error {
+ wIter := NewCommitPostIterator(commit)
+ wIter.ForEach(func(c *Commit) error {
commits = append(commits, c)
return nil
})