diff options
author | zeripath <art27@cantab.net> | 2019-11-13 07:01:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-13 07:01:19 +0000 |
commit | 722a7c902dd39bd3d4328345ca969220640774d7 (patch) | |
tree | 7fb83b70fd9df55fd7d3a805adf38238d6a9bca8 /models/repo_sign.go | |
parent | 7b97e045557788efee6803261cf612eaf975c6be (diff) | |
download | gitea-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 'models/repo_sign.go')
-rw-r--r-- | models/repo_sign.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo_sign.go b/models/repo_sign.go index bac69f76a8..a02b027f89 100644 --- a/models/repo_sign.go +++ b/models/repo_sign.go @@ -149,6 +149,7 @@ func (repo *Repository) SignWikiCommit(u *User) (bool, string) { if err != nil { return false, "" } + defer gitRepo.Close() commit, err := gitRepo.GetCommit("HEAD") if err != nil { return false, "" @@ -194,6 +195,7 @@ func (repo *Repository) SignCRUDAction(u *User, tmpBasePath, parentCommit string if err != nil { return false, "" } + defer gitRepo.Close() commit, err := gitRepo.GetCommit(parentCommit) if err != nil { return false, "" @@ -242,6 +244,7 @@ func (repo *Repository) SignMerge(u *User, tmpBasePath, baseCommit, headCommit s if err != nil { return false, "" } + defer gitRepo.Close() } commit, err := gitRepo.GetCommit(baseCommit) if err != nil { @@ -257,6 +260,7 @@ func (repo *Repository) SignMerge(u *User, tmpBasePath, baseCommit, headCommit s if err != nil { return false, "" } + defer gitRepo.Close() } commit, err := gitRepo.GetCommit(headCommit) if err != nil { @@ -272,6 +276,7 @@ func (repo *Repository) SignMerge(u *User, tmpBasePath, baseCommit, headCommit s if err != nil { return false, "" } + defer gitRepo.Close() } commit, err := gitRepo.GetCommit(headCommit) if err != nil { |