mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -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
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user