1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Some code improvements (#14266)

This commit is contained in:
Lunny Xiao
2021-01-07 03:23:57 +08:00
committed by GitHub
parent 8688c2be95
commit 3c96a37162
5 changed files with 17 additions and 3 deletions

View File

@ -670,6 +670,8 @@ func IsHeadEqualWithBranch(pr *models.PullRequest, branchName string) (bool, err
if err != nil {
return false, err
}
defer baseGitRepo.Close()
baseCommit, err := baseGitRepo.GetBranchCommit(branchName)
if err != nil {
return false, err
@ -682,6 +684,8 @@ func IsHeadEqualWithBranch(pr *models.PullRequest, branchName string) (bool, err
if err != nil {
return false, err
}
defer headGitRepo.Close()
headCommit, err := headGitRepo.GetBranchCommit(pr.HeadBranch)
if err != nil {
return false, err