summaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-03-09 07:06:38 +0000
committerGitHub <noreply@github.com>2020-03-09 07:06:38 +0000
commit3fc4f3670cb748e02d786111d2029ef1e23a9640 (patch)
treef92527a6e0699eb4092eebd1b4ec6db1462bb0d1 /modules/git
parentec4d0cdd56387a49c9c20f238768ea292c6b1222 (diff)
downloadgitea-3fc4f3670cb748e02d786111d2029ef1e23a9640.tar.gz
gitea-3fc4f3670cb748e02d786111d2029ef1e23a9640.zip
Fix panic in API pulls when headbranch does not exist (#10676)
* Fix panic in API pulls when headbranch does not exist * refix other reference to plumbing.ErrReferenceNotFound Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_commit.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index d20c6540eb..618b89438c 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -21,6 +21,11 @@ import (
func (repo *Repository) GetRefCommitID(name string) (string, error) {
ref, err := repo.gogitRepo.Reference(plumbing.ReferenceName(name), true)
if err != nil {
+ if err == plumbing.ErrReferenceNotFound {
+ return "", ErrNotExist{
+ ID: name,
+ }
+ }
return "", err
}