Skip to content

Commit

Permalink
Merge remote-tracking branch 'main/release/v1.16' into codeberg-1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Apr 21, 2022
2 parents 957e241 + 297346a commit 0d4752c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ func RepoIDAssignment() func(ctx *Context) {

// RepoAssignment returns a middleware to handle repository assignment
func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
if _, repoAssignmentOnce := ctx.Data["repoAssignmentExecuted"]; repoAssignmentOnce {
log.Trace("RepoAssignment was exec already, skipping second call ...")
return
}
ctx.Data["repoAssignmentExecuted"] = true

var (
owner *user_model.User
err error
Expand Down Expand Up @@ -596,6 +602,9 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
ctx.ServerError("RepoAssignment Invalid repo "+repo_model.RepoPath(userName, repoName), err)
return
}
if ctx.Repo.GitRepo != nil {
ctx.Repo.GitRepo.Close()
}
ctx.Repo.GitRepo = gitRepo

// We opened it, we should close it
Expand Down

0 comments on commit 0d4752c

Please sign in to comment.