aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-04-20 14:43:15 +0000
committerGitHub <noreply@github.com>2022-04-20 16:43:15 +0200
commit5e68fe7d37561aa9df470e4980cff833a7ee4f5f (patch)
tree1fb4ee815b16f6c06243c7cf052f854be65d94ee /services
parentf2229e0566478f8a2d8b968777f8ff356f1d4900 (diff)
downloadgitea-5e68fe7d37561aa9df470e4980cff833a7ee4f5f.tar.gz
gitea-5e68fe7d37561aa9df470e4980cff833a7ee4f5f.zip
Don't allow merging PR's which are being conflict checked (#19357)
* Don't allow merging PR's which are being conflict checked - When a PR is still being conflict checked, don't allow the PR to be merged(the merge button could already be visible before e.g. a new commit was pushed to the PR). - Relevant(should prevent such issue from happening) #19352 Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'services')
-rw-r--r--services/pull/check.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/pull/check.go b/services/pull/check.go
index 253417072c..29dc88e0f0 100644
--- a/services/pull/check.go
+++ b/services/pull/check.go
@@ -36,6 +36,7 @@ var (
ErrUserNotAllowedToMerge = errors.New("user not allowed to merge")
ErrHasMerged = errors.New("has already been merged")
ErrIsWorkInProgress = errors.New("work in progress PRs cannot be merged")
+ ErrIsChecking = errors.New("cannot merge while conflict checking is in progress")
ErrNotMergableState = errors.New("not in mergeable state")
ErrDependenciesLeft = errors.New("is blocked by an open dependency")
)
@@ -88,6 +89,10 @@ func CheckPullMergable(ctx context.Context, doer *user_model.User, perm *models.
return ErrNotMergableState
}
+ if pr.IsChecking() {
+ return ErrIsChecking
+ }
+
if err := CheckPRReadyToMerge(ctx, pr, false); err != nil {
if models.IsErrDisallowedToMerge(err) {
if force {