|
|
@ -410,6 +410,12 @@ func RepoIDAssignment() func(ctx *Context) {
|
|
|
|
|
|
|
|
|
|
|
|
// RepoAssignment returns a middleware to handle repository assignment
|
|
|
|
// RepoAssignment returns a middleware to handle repository assignment
|
|
|
|
func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
|
|
|
|
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 (
|
|
|
|
var (
|
|
|
|
owner *user_model.User
|
|
|
|
owner *user_model.User
|
|
|
|
err error
|
|
|
|
err error
|
|
|
@ -592,6 +598,9 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
|
|
|
|
ctx.ServerError("RepoAssignment Invalid repo "+repo_model.RepoPath(userName, repoName), err)
|
|
|
|
ctx.ServerError("RepoAssignment Invalid repo "+repo_model.RepoPath(userName, repoName), err)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ctx.Repo.GitRepo != nil {
|
|
|
|
|
|
|
|
ctx.Repo.GitRepo.Close()
|
|
|
|
|
|
|
|
}
|
|
|
|
ctx.Repo.GitRepo = gitRepo
|
|
|
|
ctx.Repo.GitRepo = gitRepo
|
|
|
|
|
|
|
|
|
|
|
|
// We opened it, we should close it
|
|
|
|
// We opened it, we should close it
|
|
|
|