mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Propagate context and ensure git commands run in request context (#17868)
This PR continues the work in #17125 by progressively ensuring that git commands run within the request context. This now means that the if there is a git repo already open in the context it will be used instead of reopening it. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@@ -263,7 +263,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
||||
}
|
||||
}
|
||||
|
||||
commitStatus, err := pull_service.GetIssuesLastCommitStatus(issues)
|
||||
commitStatus, err := pull_service.GetIssuesLastCommitStatus(ctx, issues)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetIssuesLastCommitStatus", err)
|
||||
return
|
||||
@@ -1434,14 +1434,14 @@ func ViewIssue(ctx *context.Context) {
|
||||
if comment.Review == nil {
|
||||
continue
|
||||
}
|
||||
if err = comment.Review.LoadAttributes(); err != nil {
|
||||
if err = comment.Review.LoadAttributes(ctx); err != nil {
|
||||
if !user_model.IsErrUserNotExist(err) {
|
||||
ctx.ServerError("Review.LoadAttributes", err)
|
||||
return
|
||||
}
|
||||
comment.Review.Reviewer = user_model.NewGhostUser()
|
||||
}
|
||||
if err = comment.Review.LoadCodeComments(); err != nil {
|
||||
if err = comment.Review.LoadCodeComments(ctx); err != nil {
|
||||
ctx.ServerError("Review.LoadCodeComments", err)
|
||||
return
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
}
|
||||
} else if comment.Type == models.CommentTypePullPush {
|
||||
participants = addParticipant(comment.Poster, participants)
|
||||
if err = comment.LoadPushCommits(); err != nil {
|
||||
if err = comment.LoadPushCommits(ctx); err != nil {
|
||||
ctx.ServerError("LoadPushCommits", err)
|
||||
return
|
||||
}
|
||||
@@ -1583,7 +1583,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
}
|
||||
ctx.Data["WillSign"] = false
|
||||
if ctx.User != nil {
|
||||
sign, key, _, err := asymkey_service.SignMerge(pull, ctx.User, pull.BaseRepo.RepoPath(), pull.BaseBranch, pull.GetGitRefName())
|
||||
sign, key, _, err := asymkey_service.SignMerge(ctx, pull, ctx.User, pull.BaseRepo.RepoPath(), pull.BaseBranch, pull.GetGitRefName())
|
||||
ctx.Data["WillSign"] = sign
|
||||
ctx.Data["SigningKey"] = key
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user