Skip to content

Commit

Permalink
Convert plumbing.ErrObjectNotFound to git.ErrNotExist in getCommit (#…
Browse files Browse the repository at this point in the history
…10862)

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Antoine GIRARD <[email protected]>
  • Loading branch information
4 people authored Mar 28, 2020
1 parent ea67e56 commit 052bff0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/git/repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
gogitCommit, err := repo.gogitRepo.CommitObject(id)
if err == plumbing.ErrObjectNotFound {
tagObject, err = repo.gogitRepo.TagObject(id)
if err == plumbing.ErrObjectNotFound {
return nil, ErrNotExist{
ID: id.String(),
}
}
if err == nil {
gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
}
// if we get a plumbing.ErrObjectNotFound here then the repository is broken and it should be 500
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 052bff0

Please sign in to comment.