diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/merge_requests/refresh_service.rb | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 4a7e6930842..22596b4014a 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -60,7 +60,15 @@ module MergeRequests merge_requests = filter_merge_requests(merge_requests) merge_requests.each do |merge_request| - reload_diff(merge_request) unless branch_removed? + if merge_request.source_branch == @branch_name || force_push? + merge_request.reload_diff + else + mr_commit_ids = merge_request.commits.map(&:id) + push_commit_ids = @commits.map(&:id) + matches = mr_commit_ids & push_commit_ids + merge_request.reload_diff if matches.any? + end + merge_request.mark_as_unchecked end end @@ -165,16 +173,5 @@ module MergeRequests def branch_removed? Gitlab::Git.blank_ref?(@newrev) end - - def reload_diff(merge_request) - if merge_request.source_branch == @branch_name || force_push? - merge_request.reload_diff - else - mr_commit_ids = merge_request.commits.map(&:id) - push_commit_ids = @commits.map(&:id) - matches = mr_commit_ids & push_commit_ids - merge_request.reload_diff if matches.any? - end - end end end |