diff options
Diffstat (limited to 'app/services/merge_requests/mergeability_check_service.rb')
-rw-r--r-- | app/services/merge_requests/mergeability_check_service.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/services/merge_requests/mergeability_check_service.rb b/app/services/merge_requests/mergeability_check_service.rb index a3c39fa2e32..627c747203c 100644 --- a/app/services/merge_requests/mergeability_check_service.rb +++ b/app/services/merge_requests/mergeability_check_service.rb @@ -88,7 +88,7 @@ module MergeRequests sleep_sec: retry_lease ? 1.second : 0 } - in_lock(lease_key, lease_opts, &block) + in_lock(lease_key, **lease_opts, &block) end def payload @@ -115,18 +115,20 @@ module MergeRequests def update_merge_status return unless merge_request.recheck_merge_status? + return merge_request.mark_as_unmergeable if merge_request.broken? - if can_git_merge? && merge_to_ref + merge_to_ref_success = merge_to_ref + + update_diff_discussion_positions! if merge_to_ref_success + + if merge_to_ref_success && can_git_merge? merge_request.mark_as_mergeable - update_diff_discussion_positions! else merge_request.mark_as_unmergeable end end def update_diff_discussion_positions! - return if Feature.disabled?(:merge_ref_head_comments, merge_request.target_project, default_enabled: true) - Discussions::CaptureDiffNotePositionsService.new(merge_request).execute end @@ -151,13 +153,14 @@ module MergeRequests end def can_git_merge? - !merge_request.broken? && repository.can_be_merged?(merge_request.diff_head_sha, merge_request.target_branch) + repository.can_be_merged?(merge_request.diff_head_sha, merge_request.target_branch) end def merge_to_ref return true unless merge_ref_auto_sync_enabled? - result = MergeRequests::MergeToRefService.new(project, merge_request.author).execute(merge_request) + params = { allow_conflicts: Feature.enabled?(:display_merge_conflicts_in_diff, project) } + result = MergeRequests::MergeToRefService.new(project, merge_request.author, params).execute(merge_request) result[:status] == :success end |