summaryrefslogtreecommitdiffstats
path: root/routers/admin
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-05-14 21:19:38 +0100
committerGitHub <noreply@github.com>2021-05-14 21:19:38 +0100
commitd0ea10b21fb252c4f82a193b62a776e482e4bdfb (patch)
tree6cded84ee822eec2faf916e7b3d4f765190c4f4c /routers/admin
parentf6be429781b24b1ac3b6e719b9c64df33866db93 (diff)
downloadgitea-d0ea10b21fb252c4f82a193b62a776e482e4bdfb.tar.gz
gitea-d0ea10b21fb252c4f82a193b62a776e482e4bdfb.zip
Close the gitrepo when deleting the repository (#15876)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/admin')
-rw-r--r--routers/admin/repos.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/admin/repos.go b/routers/admin/repos.go
index 82b8cc1a7d..d23f7c3d5a 100644
--- a/routers/admin/repos.go
+++ b/routers/admin/repos.go
@@ -47,6 +47,10 @@ func DeleteRepo(ctx *context.Context) {
return
}
+ if ctx.Repo != nil && ctx.Repo.GitRepo != nil && ctx.Repo.Repository != nil && ctx.Repo.Repository.ID == repo.ID {
+ ctx.Repo.GitRepo.Close()
+ }
+
if err := repo_service.DeleteRepository(ctx.User, repo); err != nil {
ctx.ServerError("DeleteRepository", err)
return