summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-01-25 21:07:32 -0200
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-01-26 13:58:06 -0200
commit391743cfb91243b158ce28909f8856d152b33697 (patch)
tree359cb2fbaf07e6c7cca5221a142224c0437ca106
parentbdd7e6d19dcc895004d7965067456079fd6f6b07 (diff)
downloadgitlab-ce-osw-fix-lost-diffs-when-source-branch-deleted.tar.gz
-rw-r--r--app/services/merge_requests/refresh_service.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb
index d3beb2bd260..d26bcce423e 100644
--- a/app/services/merge_requests/refresh_service.rb
+++ b/app/services/merge_requests/refresh_service.rb
@@ -9,8 +9,8 @@ module MergeRequests
Gitlab::GitalyClient.allow_n_plus_1_calls(&method(:find_new_commits))
# Be sure to close outstanding MRs before reloading them to avoid generating an
# empty diff during a manual merge
- close_merge_requests
- fully_merge_manually_merged_merge_requests
+ close_upon_missing_source_branch_ref
+ post_merge_manually_merged
reload_merge_requests
reset_merge_when_pipeline_succeeds
mark_pending_todos_done
@@ -34,7 +34,7 @@ module MergeRequests
# and close if push to master include last commit from merge request
# We need this to close(as merged) merge requests that were merged into
# target branch manually
- def fully_merge_manually_merged_merge_requests
+ def post_merge_manually_merged
commit_ids = @commits.map(&:id)
merge_requests = @project.merge_requests.preload(:latest_merge_request_diff).opened.where(target_branch: @branch_name).to_a
merge_requests = merge_requests.select(&:diff_head_commit)
@@ -51,7 +51,7 @@ module MergeRequests
end
end
- def close_merge_requests
+ def close_upon_missing_source_branch_ref
# MergeRequest#reload_diff ignores not opened MRs. This means it won't
# create an `empty` diff for `closed` MRs without a source branch, keeping
# the latest diff state as the last _valid_ one.