diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2016-11-18 13:14:44 +0300 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2016-11-21 15:26:26 +0300 |
commit | 9e9965ba5ce5a2acca97325412c63eed398ef80b (patch) | |
tree | 365949ae69b51937ba3b6c06fb3fecfcaeb3923a /app | |
parent | 5018bdcd0ab45df924956125f9d11f66847f8164 (diff) |
Revert "Do not create a MergeRequestDiff record when source branch is deleted"
This reverts commit f913170e2f76ef44800f0272cb7fb40b9d6709ee.
Diffstat (limited to 'app')
-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 |