aboutsummaryrefslogtreecommitdiffstats
path: root/services/pull/merge.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-03-22 23:22:54 +0800
committerGitHub <noreply@github.com>2022-03-22 16:22:54 +0100
commit7a550b3af20dad94cf468012a6b817b43b91c1ba (patch)
tree1b836eabf8e911f35d0446c0cdad053cb3572c79 /services/pull/merge.go
parent2b55422cd71b0b325f054646de5cebf39b72b502 (diff)
downloadgitea-7a550b3af20dad94cf468012a6b817b43b91c1ba.tar.gz
gitea-7a550b3af20dad94cf468012a6b817b43b91c1ba.zip
Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163)
* Remove `db.DefaultContext` usage in routers, use `ctx` directly * Use `ctx` directly if there is one, remove some `db.DefaultContext` in `services` * Use ctx instead of db.DefaultContext for `cmd` and some `modules` packages * fix incorrect context usage
Diffstat (limited to 'services/pull/merge.go')
-rw-r--r--services/pull/merge.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/services/pull/merge.go b/services/pull/merge.go
index cb857cc60d..6108a7956e 100644
--- a/services/pull/merge.go
+++ b/services/pull/merge.go
@@ -17,7 +17,6 @@ import (
"time"
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
@@ -80,7 +79,7 @@ func Merge(ctx context.Context, pr *models.PullRequest, doer *user_model.User, b
if err := pr.Issue.LoadRepo(); err != nil {
log.Error("loadRepo for issue [%d]: %v", pr.ID, err)
}
- if err := pr.Issue.Repo.GetOwner(db.DefaultContext); err != nil {
+ if err := pr.Issue.Repo.GetOwner(ctx); err != nil {
log.Error("GetOwner for issue repo [%d]: %v", pr.ID, err)
}
@@ -487,7 +486,7 @@ func rawMerge(ctx context.Context, pr *models.PullRequest, doer *user_model.User
}
var headUser *user_model.User
- err = pr.HeadRepo.GetOwner(db.DefaultContext)
+ err = pr.HeadRepo.GetOwner(ctx)
if err != nil {
if !user_model.IsErrUserNotExist(err) {
log.Error("Can't find user: %d for head repository - %v", pr.HeadRepo.OwnerID, err)