diff options
author | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2019-02-13 09:57:27 +0100 |
---|---|---|
committer | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2019-02-13 10:31:12 +0100 |
commit | 2b248220113c6eb8699da4aebdb6665b9751f471 (patch) | |
tree | 60eab161206a9aa1d017e2d85dbc6c3eb2553a7b /plumbing/object | |
parent | 6c2a0daafcd6c8f3f695c8b7a2c881d3abc276b1 (diff) | |
download | go-git-2b248220113c6eb8699da4aebdb6665b9751f471.tar.gz |
Improve error handling logic
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
Diffstat (limited to 'plumbing/object')
-rw-r--r-- | plumbing/object/commit_walker.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plumbing/object/commit_walker.go b/plumbing/object/commit_walker.go index fabd0c9..0eff059 100644 --- a/plumbing/object/commit_walker.go +++ b/plumbing/object/commit_walker.go @@ -197,12 +197,12 @@ func NewCommitAllIter(repoStorer storage.Storer, commitIterFunc func(*Commit) Co commitsPath := list.New() commitsLookup := make(map[plumbing.Hash]*list.Element) head, err := storer.ResolveReference(repoStorer, plumbing.HEAD) + if err == nil { + err = addReference(repoStorer, commitIterFunc, head, commitsPath, commitsLookup) + } + if err != nil && err != plumbing.ErrReferenceNotFound { return nil, err - } else if err != plumbing.ErrReferenceNotFound { - if err = addReference(repoStorer, commitIterFunc, head, commitsPath, commitsLookup); err != nil { - return nil, err - } } // add all references along with the HEAD |