summaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-03-28 18:59:21 +0000
committerGitHub <noreply@github.com>2020-03-28 20:59:21 +0200
commit052bff0cff30f43ddd656bccc36b29bce3866393 (patch)
treec79c0fbe2999310ea4ded945789b658079876812 /modules/git
parentea67e563dd9fc20e508d41079ea00312b880ac82 (diff)
downloadgitea-052bff0cff30f43ddd656bccc36b29bce3866393.tar.gz
gitea-052bff0cff30f43ddd656bccc36b29bce3866393.zip
Convert plumbing.ErrObjectNotFound to git.ErrNotExist in getCommit (#10862)
Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_commit.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index a7a7c66231..c5f6d6cdd6 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -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