Skip to content

Commit 0d4752c

Browse files
committed
Merge remote-tracking branch 'main/release/v1.16' into codeberg-1.16
2 parents 957e241 + 297346a commit 0d4752c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/context/repo.go

+9
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,12 @@ func RepoIDAssignment() func(ctx *Context) {
410410

411411
// RepoAssignment returns a middleware to handle repository assignment
412412
func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
413+
if _, repoAssignmentOnce := ctx.Data["repoAssignmentExecuted"]; repoAssignmentOnce {
414+
log.Trace("RepoAssignment was exec already, skipping second call ...")
415+
return
416+
}
417+
ctx.Data["repoAssignmentExecuted"] = true
418+
413419
var (
414420
owner *user_model.User
415421
err error
@@ -596,6 +602,9 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
596602
ctx.ServerError("RepoAssignment Invalid repo "+repo_model.RepoPath(userName, repoName), err)
597603
return
598604
}
605+
if ctx.Repo.GitRepo != nil {
606+
ctx.Repo.GitRepo.Close()
607+
}
599608
ctx.Repo.GitRepo = gitRepo
600609

601610
// We opened it, we should close it

0 commit comments

Comments
 (0)