aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/web/repo/compare.go3
-rw-r--r--routers/web/repo/pull.go2
2 files changed, 2 insertions, 3 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index 278974bec3..9d241d3b51 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -405,7 +405,6 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo {
ctx.ServerError("OpenRepository", err)
return nil
}
- defer ci.HeadGitRepo.Close()
} else {
ctx.NotFound("ParseCompareInfo", nil)
return nil
@@ -708,7 +707,7 @@ func getBranchesAndTagsForRepo(ctx gocontext.Context, repo *repo_model.Repositor
func CompareDiff(ctx *context.Context) {
ci := ParseCompareInfo(ctx)
defer func() {
- if ci != nil && ci.HeadGitRepo != nil {
+ if !ctx.Repo.PullRequest.SameRepo && ci != nil && ci.HeadGitRepo != nil {
ci.HeadGitRepo.Close()
}
}()
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index e068ac45c6..ac08bf2a4f 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -1263,7 +1263,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
ci := ParseCompareInfo(ctx)
defer func() {
- if ci != nil && ci.HeadGitRepo != nil {
+ if !ctx.Repo.PullRequest.SameRepo && ci != nil && ci.HeadGitRepo != nil {
ci.HeadGitRepo.Close()
}
}()