diff options
author | Robert Speicher <robert@gitlab.com> | 2016-01-06 18:58:10 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-06 13:58:49 -0500 |
commit | f076e4ebeb5cba94233f9795db6c60a60a553dff (patch) | |
tree | bf9875ed2201987988a648ba7eae5468fe794a21 /lib | |
parent | be19feca36d100b4c2ac7a214c12346728b77ec1 (diff) | |
download | gitlab-ce-f076e4ebeb5cba94233f9795db6c60a60a553dff.tar.gz |
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? |