Commit eed99e9b authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix/reduce-number-of-ref-exists-calls' into 'master'

Check for keep-around commits once if target and source projects are the same

Closes #37439 and gitaly#1000

See merge request gitlab-org/gitlab-ce!16972
parents 0b9825ca 457e702b
...@@ -290,7 +290,7 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -290,7 +290,7 @@ class MergeRequestDiff < ActiveRecord::Base
end end
def keep_around_commits def keep_around_commits
[repository, merge_request.source_project.repository].each do |repo| [repository, merge_request.source_project.repository].uniq.each do |repo|
repo.keep_around(start_commit_sha) repo.keep_around(start_commit_sha)
repo.keep_around(head_commit_sha) repo.keep_around(head_commit_sha)
repo.keep_around(base_commit_sha) repo.keep_around(base_commit_sha)
......
...@@ -9,11 +9,8 @@ module MergeRequests ...@@ -9,11 +9,8 @@ module MergeRequests
merge_request.source_branch = params[:source_branch] merge_request.source_branch = params[:source_branch]
merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch) merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch)
# n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37439
Gitlab::GitalyClient.allow_n_plus_1_calls do
create(merge_request) create(merge_request)
end end
end
def before_create(merge_request) def before_create(merge_request)
# current_user (defined in BaseService) is not available within run_after_commit block # current_user (defined in BaseService) is not available within run_after_commit block
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment