summaryrefslogtreecommitdiffstats
path: root/routers
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 /routers
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 'routers')
-rw-r--r--routers/repo/branch.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index ea4f68948d..7127d50ed8 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -17,7 +17,6 @@ import (
"code.gitea.io/gitea/modules/repofiles"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/util"
- "gopkg.in/src-d/go-git.v4/plumbing"
)
const (
@@ -253,7 +252,7 @@ func loadBranches(ctx *context.Context) []*Branch {
repoIDToGitRepo[pr.BaseRepoID] = baseGitRepo
}
pullCommit, err := baseGitRepo.GetRefCommitID(pr.GetGitRefName())
- if err != nil && err != plumbing.ErrReferenceNotFound {
+ if err != nil && !git.IsErrNotExist(err) {
ctx.ServerError("GetBranchCommitID", err)
return nil
}