diff options
author | Joshua Sjoding <joshua.sjoding@scjalliance.com> | 2016-02-16 03:28:21 -0800 |
---|---|---|
committer | Joshua Sjoding <joshua.sjoding@scjalliance.com> | 2016-02-16 03:28:21 -0800 |
commit | e82d4918b403a641a5295b3f199586b0ab26b15c (patch) | |
tree | 7b16fa8616393ed911824ff5155f40f1b9c38716 /repository.go | |
parent | 45478768e1fa49030b574aec13390fb2d9479836 (diff) | |
download | go-git-e82d4918b403a641a5295b3f199586b0ab26b15c.tar.gz |
Functions in core.ObjectStorage interface now return an error
Diffstat (limited to 'repository.go')
-rw-r--r-- | repository.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/repository.go b/repository.go index d0bc103..b8920c0 100644 --- a/repository.go +++ b/repository.go @@ -89,9 +89,12 @@ func (r *Repository) Pull(remoteName, branch string) (err error) { // Commit return the commit with the given hash func (r *Repository) Commit(h core.Hash) (*Commit, error) { - obj, ok := r.Storage.Get(h) - if !ok { - return nil, ObjectNotFoundErr + obj, err := r.Storage.Get(h) + if err != nil { + if err == core.ObjectNotFoundErr { + return nil, ObjectNotFoundErr + } + return nil, err } commit := &Commit{r: r} @@ -105,9 +108,12 @@ func (r *Repository) Commits() *CommitIter { // Tree return the tree with the given hash func (r *Repository) Tree(h core.Hash) (*Tree, error) { - obj, ok := r.Storage.Get(h) - if !ok { - return nil, ObjectNotFoundErr + obj, err := r.Storage.Get(h) + if err != nil { + if err == core.ObjectNotFoundErr { + return nil, ObjectNotFoundErr + } + return nil, err } tree := &Tree{r: r} |