aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/repo_base_gogit.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2024-02-25 14:05:23 +0100
committerGitHub <noreply@github.com>2024-02-25 13:05:23 +0000
commitad0a34b492c3d41952ff4648c8bfb7b54c376151 (patch)
tree3baacd6be322061bd9d53db7c61f7b82e4fa3f72 /modules/git/repo_base_gogit.go
parent0676bf52f95b9c9ac6f5679bd263d844e6a83fa1 (diff)
downloadgitea-ad0a34b492c3d41952ff4648c8bfb7b54c376151.tar.gz
gitea-ad0a34b492c3d41952ff4648c8bfb7b54c376151.zip
Add `io.Closer` guidelines (#29387)
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
Diffstat (limited to 'modules/git/repo_base_gogit.go')
-rw-r--r--modules/git/repo_base_gogit.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/git/repo_base_gogit.go b/modules/git/repo_base_gogit.go
index 9270bb70f0..3ca5eb36c6 100644
--- a/modules/git/repo_base_gogit.go
+++ b/modules/git/repo_base_gogit.go
@@ -88,16 +88,17 @@ func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) {
}
// Close this repository, in particular close the underlying gogitStorage if this is not nil
-func (repo *Repository) Close() (err error) {
+func (repo *Repository) Close() error {
if repo == nil || repo.gogitStorage == nil {
- return
+ return nil
}
if err := repo.gogitStorage.Close(); err != nil {
gitealog.Error("Error closing storage: %v", err)
}
+ repo.gogitStorage = nil
repo.LastCommitCache = nil
repo.tagCache = nil
- return
+ return nil
}
// GoGitRepo gets the go-git repo representation