aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-01-07 03:23:57 +0800
committerGitHub <noreply@github.com>2021-01-06 19:23:57 +0000
commit3c96a3716288b0ae1ae65df44cc92218b489b77f (patch)
tree014f698c969dfaad3602681e07140f75263889a9 /services
parent8688c2be95f1d11fadd6cbb979eafe0bb817589a (diff)
downloadgitea-3c96a3716288b0ae1ae65df44cc92218b489b77f.tar.gz
gitea-3c96a3716288b0ae1ae65df44cc92218b489b77f.zip
Some code improvements (#14266)
Diffstat (limited to 'services')
-rw-r--r--services/pull/pull.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go
index 35dcbf9604..1886448ee0 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -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