diff options
author | Sean McGivern <sean@gitlab.com> | 2017-02-01 14:28:04 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-02-03 09:46:03 +0000 |
commit | 7550f60ddeecebac3f84e8690ab3f42428600ff7 (patch) | |
tree | f2121574ae7e46a2cc970f92a1287ad1289c4e5b /app/services/merge_requests | |
parent | fd46fb1cd9cc1fdf826d31261aa594baa38d4898 (diff) | |
download | gitlab-ce-7550f60ddeecebac3f84e8690ab3f42428600ff7.tar.gz |
Backport changes from EE squash
Backport changes from the EE-only squash implementation, which would
otherwise conflict when merge CE into EE.
<https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1024>
Diffstat (limited to 'app/services/merge_requests')
-rw-r--r-- | app/services/merge_requests/merge_service.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index ab9056a3250..5ca6fec962d 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -6,13 +6,17 @@ module MergeRequests # Executed when you do merge via GitLab UI # class MergeService < MergeRequests::BaseService - attr_reader :merge_request + attr_reader :merge_request, :source def execute(merge_request) @merge_request = merge_request return log_merge_error('Merge request is not mergeable', true) unless @merge_request.mergeable? + @source = find_merge_source + + return log_merge_error('No source for merge', true) unless @source + merge_request.in_locked_state do if commit after_merge @@ -34,7 +38,7 @@ module MergeRequests committer: committer } - commit_id = repository.merge(current_user, merge_request, options) + commit_id = repository.merge(current_user, source, merge_request, options) if commit_id merge_request.update(merge_commit_sha: commit_id) @@ -73,9 +77,11 @@ module MergeRequests end def merge_request_info - project = merge_request.project + merge_request.to_reference(full: true) + end - "#{project.to_reference}#{merge_request.to_reference}" + def find_merge_source + merge_request.diff_head_sha end end end |