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:
@@ -68,7 +68,7 @@ func CreateCodeComment(ctx *context.Context) {
|
||||
signedLine *= -1
|
||||
}
|
||||
|
||||
comment, err := pull_service.CreateCodeComment(
|
||||
comment, err := pull_service.CreateCodeComment(ctx,
|
||||
ctx.User,
|
||||
ctx.Repo.GitRepo,
|
||||
issue,
|
||||
@@ -152,7 +152,7 @@ func UpdateResolveConversation(ctx *context.Context) {
|
||||
}
|
||||
|
||||
func renderConversation(ctx *context.Context, comment *models.Comment) {
|
||||
comments, err := models.FetchCodeCommentsByLine(comment.Issue, ctx.User, comment.TreePath, comment.Line)
|
||||
comments, err := models.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.User, comment.TreePath, comment.Line)
|
||||
if err != nil {
|
||||
ctx.ServerError("FetchCodeCommentsByLine", err)
|
||||
return
|
||||
@@ -217,7 +217,7 @@ func SubmitReview(ctx *context.Context) {
|
||||
attachments = form.Files
|
||||
}
|
||||
|
||||
_, comm, err := pull_service.SubmitReview(ctx.User, ctx.Repo.GitRepo, issue, reviewType, form.Content, form.CommitID, attachments)
|
||||
_, comm, err := pull_service.SubmitReview(ctx, ctx.User, ctx.Repo.GitRepo, issue, reviewType, form.Content, form.CommitID, attachments)
|
||||
if err != nil {
|
||||
if models.IsContentEmptyErr(err) {
|
||||
ctx.Flash.Error(ctx.Tr("repo.issues.review.content.empty"))
|
||||
@@ -234,7 +234,7 @@ func SubmitReview(ctx *context.Context) {
|
||||
// DismissReview dismissing stale review by repo admin
|
||||
func DismissReview(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.DismissReviewForm)
|
||||
comm, err := pull_service.DismissReview(form.ReviewID, form.Message, ctx.User, true)
|
||||
comm, err := pull_service.DismissReview(ctx, form.ReviewID, form.Message, ctx.User, true)
|
||||
if err != nil {
|
||||
ctx.ServerError("pull_service.DismissReview", err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user