summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/merge.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/pull/merge.go b/services/pull/merge.go
index a20a214014..47521ce147 100644
--- a/services/pull/merge.go
+++ b/services/pull/merge.go
@@ -574,16 +574,22 @@ func CheckPRReadyToMerge(pr *models.PullRequest) (err error) {
}
}
- if enoughApprovals := pr.ProtectedBranch.HasEnoughApprovals(pr); !enoughApprovals {
+ if !pr.ProtectedBranch.HasEnoughApprovals(pr) {
return models.ErrNotAllowedToMerge{
Reason: "Does not have enough approvals",
}
}
- if rejected := pr.ProtectedBranch.MergeBlockedByRejectedReview(pr); rejected {
+ if pr.ProtectedBranch.MergeBlockedByRejectedReview(pr) {
return models.ErrNotAllowedToMerge{
Reason: "There are requested changes",
}
}
+ if pr.ProtectedBranch.MergeBlockedByOutdatedBranch(pr) {
+ return models.ErrNotAllowedToMerge{
+ Reason: "The head branch is behind the base branch",
+ }
+ }
+
return nil
}