Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 2b24822

Browse files
committed
Improve error handling logic
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
1 parent 6c2a0da commit 2b24822

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plumbing/object/commit_walker.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ func NewCommitAllIter(repoStorer storage.Storer, commitIterFunc func(*Commit) Co
197197
commitsPath := list.New()
198198
commitsLookup := make(map[plumbing.Hash]*list.Element)
199199
head, err := storer.ResolveReference(repoStorer, plumbing.HEAD)
200+
if err == nil {
201+
err = addReference(repoStorer, commitIterFunc, head, commitsPath, commitsLookup)
202+
}
203+
200204
if err != nil && err != plumbing.ErrReferenceNotFound {
201205
return nil, err
202-
} else if err != plumbing.ErrReferenceNotFound {
203-
if err = addReference(repoStorer, commitIterFunc, head, commitsPath, commitsLookup); err != nil {
204-
return nil, err
205-
}
206206
}
207207

208208
// add all references along with the HEAD

0 commit comments

Comments
 (0)