aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
diff options
context:
space:
mode:
authorkuba-- <kuba@sourced.tech>2019-01-08 11:30:43 +0100
committerkuba-- <kuba@sourced.tech>2019-01-08 11:30:43 +0100
commitf65d7f4c42cccd3a1daaef3ce3c3a5cfe006d3c4 (patch)
tree4b3dee0526e07fb08cd926a163b55efc1ff9caac /plumbing/object
parent3180dff8c5618b2e146a7fb4ac36be10851c86cc (diff)
downloadgo-git-f65d7f4c42cccd3a1daaef3ce3c3a5cfe006d3c4.tar.gz
First lookup if hash exists, then GetCommit.
Signed-off-by: kuba-- <kuba@sourced.tech>
Diffstat (limited to 'plumbing/object')
-rw-r--r--plumbing/object/commit_walker.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/plumbing/object/commit_walker.go b/plumbing/object/commit_walker.go
index ab06cb2..92c6572 100644
--- a/plumbing/object/commit_walker.go
+++ b/plumbing/object/commit_walker.go
@@ -225,18 +225,18 @@ func NewCommitAllIter(s storage.Storer, fn func(*Commit) CommitIter) (CommitIter
// we already have the HEAD
return nil
}
- c, _ := GetCommit(s, r.Hash())
- // if it's not a commit - skip it.
- if c == nil {
- return nil
- }
- el, ok := m[c.Hash]
+ el, ok := m[r.Hash()]
if ok {
return nil
}
var refCommits []*Commit
+ c, _ := GetCommit(s, r.Hash())
+ // if it's not a commit - skip it.
+ if c == nil {
+ return nil
+ }
cit := fn(c)
for c, e := cit.Next(); e == nil; {
el, ok = m[c.Hash]