diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-30 12:13:24 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-30 12:13:24 +0000 |
commit | b7e318f9178ad00e412c8c0c11c7ec2d1235a8fa (patch) | |
tree | bb3501682f1d45024d21534b264a85cfba8f9b34 /app/services/merge_requests | |
parent | 317554609e350b9d96190aa985d32d8185d76489 (diff) | |
parent | 0509c3cf17976a2acb53ea84a51b0f50d1f400fb (diff) | |
download | gitlab-ce-b7e318f9178ad00e412c8c0c11c7ec2d1235a8fa.tar.gz |
Merge branch 'sh-fix-issue-53153' into 'master'
Fix extra merge request versions created from forked merge requests
Closes #53153
See merge request gitlab-org/gitlab-ce!22611
Diffstat (limited to 'app/services/merge_requests')
-rw-r--r-- | app/services/merge_requests/refresh_service.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index b03d14fa3cc..f01872b205e 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -85,7 +85,7 @@ module MergeRequests .where.not(target_project: @project).to_a filter_merge_requests(merge_requests).each do |merge_request| - if merge_request.source_branch == @push.branch_name || @push.force_push? + if branch_and_project_match?(merge_request) || @push.force_push? merge_request.reload_diff(current_user) else mr_commit_ids = merge_request.commit_shas @@ -104,6 +104,11 @@ module MergeRequests end # rubocop: enable CodeReuse/ActiveRecord + def branch_and_project_match?(merge_request) + merge_request.source_project == @project && + merge_request.source_branch == @push.branch_name + end + def reset_merge_when_pipeline_succeeds merge_requests_for_source_branch.each(&:reset_merge_when_pipeline_succeeds) end |