From 3fc4f3670cb748e02d786111d2029ef1e23a9640 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 9 Mar 2020 07:06:38 +0000 Subject: 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 --- modules/git/repo_commit.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/git') 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 } -- cgit v1.2.3