summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/commit_status.go10
-rw-r--r--services/pull/merge.go6
-rw-r--r--services/pull/pull.go2
3 files changed, 16 insertions, 2 deletions
diff --git a/services/pull/commit_status.go b/services/pull/commit_status.go
index 143f3d50d0..ec4cc2aa07 100644
--- a/services/pull/commit_status.go
+++ b/services/pull/commit_status.go
@@ -137,5 +137,13 @@ func GetPullRequestCommitStatusState(ctx context.Context, pr *models.PullRequest
return "", errors.Wrap(err, "GetLatestCommitStatus")
}
- return MergeRequiredContextsCommitStatus(commitStatuses, pr.ProtectedBranch.StatusCheckContexts), nil
+ if err := pr.LoadProtectedBranchCtx(ctx); err != nil {
+ return "", errors.Wrap(err, "LoadProtectedBranch")
+ }
+ var requiredContexts []string
+ if pr.ProtectedBranch != nil {
+ requiredContexts = pr.ProtectedBranch.StatusCheckContexts
+ }
+
+ return MergeRequiredContextsCommitStatus(commitStatuses, requiredContexts), nil
}
diff --git a/services/pull/merge.go b/services/pull/merge.go
index fe295cbe03..8cc4d88888 100644
--- a/services/pull/merge.go
+++ b/services/pull/merge.go
@@ -18,6 +18,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
+ pull_model "code.gitea.io/gitea/models/pull"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
@@ -46,6 +47,11 @@ func Merge(pr *models.PullRequest, doer *user_model.User, baseGitRepo *git.Repos
pullWorkingPool.CheckIn(fmt.Sprint(pr.ID))
defer pullWorkingPool.CheckOut(fmt.Sprint(pr.ID))
+ // Removing an auto merge pull and ignore if not exist
+ if err := pull_model.RemoveScheduledAutoMerge(db.DefaultContext, doer, pr.ID, false); err != nil && !models.IsErrNotExist(err) {
+ return err
+ }
+
prUnit, err := pr.BaseRepo.GetUnit(unit.TypePullRequests)
if err != nil {
log.Error("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v", err)
diff --git a/services/pull/pull.go b/services/pull/pull.go
index 5cef3c356f..d226c60ec2 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -253,7 +253,7 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
graceful.GetManager().RunWithShutdownContext(func(ctx context.Context) {
// There is no sensible way to shut this down ":-("
// If you don't let it run all the way then you will lose data
- // FIXME: graceful: AddTestPullRequestTask needs to become a queue!
+ // TODO: graceful: AddTestPullRequestTask needs to become a queue!
prs, err := models.GetUnmergedPullRequestsByHeadInfo(repoID, branch)
if err != nil {