summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-11-13 07:01:19 +0000
committerGitHub <noreply@github.com>2019-11-13 07:01:19 +0000
commit722a7c902dd39bd3d4328345ca969220640774d7 (patch)
tree7fb83b70fd9df55fd7d3a805adf38238d6a9bca8 /services/pull
parent7b97e045557788efee6803261cf612eaf975c6be (diff)
downloadgitea-722a7c902dd39bd3d4328345ca969220640774d7.tar.gz
gitea-722a7c902dd39bd3d4328345ca969220640774d7.zip
Add Close() method to gogitRepository (#8901)
In investigating #7947 it has become clear that the storage component of go-git repositories needs closing. This PR adds this Close function and adds the Close functions as necessary. In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files. Fixes #7947
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/commit_status.go1
-rw-r--r--services/pull/pull.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/services/pull/commit_status.go b/services/pull/commit_status.go
index 2872db7bd2..ca00cdaad9 100644
--- a/services/pull/commit_status.go
+++ b/services/pull/commit_status.go
@@ -55,6 +55,7 @@ func IsPullCommitStatusPass(pr *models.PullRequest) (bool, error) {
if err != nil {
return false, errors.Wrap(err, "OpenRepository")
}
+ defer headGitRepo.Close()
if !headGitRepo.IsBranchExist(pr.HeadBranch) {
return false, errors.New("Head branch does not exist, can not merge")
diff --git a/services/pull/pull.go b/services/pull/pull.go
index 4e981b2b26..7a9c2ef9ad 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -48,6 +48,7 @@ func checkForInvalidation(requests models.PullRequestList, repoID int64, doer *m
if err != nil {
log.Error("PullRequestList.InvalidateCodeComments: %v", err)
}
+ gitRepo.Close()
}()
return nil
}