aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/revlist/revlist.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/revlist/revlist.go')
-rw-r--r--plumbing/revlist/revlist.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/plumbing/revlist/revlist.go b/plumbing/revlist/revlist.go
index eb9afaf..fbd1bd9 100644
--- a/plumbing/revlist/revlist.go
+++ b/plumbing/revlist/revlist.go
@@ -82,20 +82,21 @@ func reachableObjects(
commit *object.Commit,
seen map[plumbing.Hash]bool,
cb func(h plumbing.Hash)) error {
- return object.WalkCommitHistory(commit, func(commit *object.Commit) error {
- if seen[commit.Hash] {
- return nil
- }
+ return object.NewCommitPreIterator(commit).
+ ForEach(func(commit *object.Commit) error {
+ if seen[commit.Hash] {
+ return nil
+ }
- cb(commit.Hash)
+ cb(commit.Hash)
- tree, err := commit.Tree()
- if err != nil {
- return err
- }
+ tree, err := commit.Tree()
+ if err != nil {
+ return err
+ }
- return iterateCommitTrees(seen, tree, cb)
- })
+ return iterateCommitTrees(seen, tree, cb)
+ })
}
// iterateCommitTrees iterate all reachable trees from the given commit