diff options
author | Robert Speicher <robert@gitlab.com> | 2016-01-06 21:58:10 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-01-06 21:58:10 +0300 |
commit | b93744e3008fd2ba313f62f9e5ad8820e0cc8582 (patch) | |
tree | cdd9f62fa483bf5c1c525b13695be1e531a3a862 /lib | |
parent | 6865d3e5001805c648ba9fefd594540eff47c7b6 (diff) | |
parent | c0849101e6d79bed12c830986c7ff63b2e2f3d9e (diff) |
Merge branch 'merge-when-build-succeeds-unchecked' into 'master'
Get "Merge when build succeeds" to work when commits were pushed to MR
target branch while builds were running
The Merge when build succeeds service only merges when the MR is
mergeable (open, not WIP, no conflicts).
When the target branch is updated, all affected MRs have their merge
status set to `unchecked`, and the conflicts check will only happen
when `check_if_can_be_merged` is called, which happens when the MR page
is viewed.
When someone enables the automatic merge, the target branch is updated,
no-one views the MR page again, and the build succeeds, the mergeability
check will fail and the MR will not in fact be merged.
This MR makes sure `check_if_can_be_merged` is always called when MR
mergeability is checked.
See merge request !2304
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/merge_requests.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 3c1c6bda260..5c97fe1c88c 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -211,7 +211,7 @@ module API unauthorized! unless merge_request.can_be_merged_by?(current_user) not_allowed! if !merge_request.open? || merge_request.work_in_progress? - merge_request.check_if_can_be_merged if merge_request.unchecked? + merge_request.check_if_can_be_merged render_api_error!('Branch cannot be merged', 406) unless merge_request.can_be_merged? |