summaryrefslogtreecommitdiffstats
path: root/modules/context/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/context/api.go')
-rw-r--r--modules/context/api.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index 024ae487f1..c1de37dd21 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -186,7 +186,16 @@ func ReferencesGitRepo(allowEmpty bool) macaron.Handler {
return
}
ctx.Repo.GitRepo = gitRepo
+ // We opened it, we should close it
+ defer func() {
+ // If it's been set to nil then assume someone else has closed it.
+ if ctx.Repo.GitRepo != nil {
+ ctx.Repo.GitRepo.Close()
+ }
+ }()
}
+
+ ctx.Next()
}
}