summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-02-07 14:51:49 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-02-07 14:51:49 +0000
commiteed99e9bb73f3993cc80641fbfef8cc86723f8c1 (patch)
tree71b115df57c7a8245733201dc12f28d263b00827
parent0b9825ca461670941a098a664e997fca04d2d9f9 (diff)
parent457e702b13f31cd967adf8c555a79fd96b9bf9e3 (diff)
downloadgitlab-ce-eed99e9bb73f3993cc80641fbfef8cc86723f8c1.tar.gz
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
-rw-r--r--app/models/merge_request_diff.rb2
-rw-r--r--app/services/merge_requests/create_service.rb5
2 files changed, 2 insertions, 5 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 69a846da9be..c1c27ccf3e5 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -290,7 +290,7 @@ class MergeRequestDiff < ActiveRecord::Base
end
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(head_commit_sha)
repo.keep_around(base_commit_sha)
diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb
index 634bf3bd690..a18b1c90765 100644
--- a/app/services/merge_requests/create_service.rb
+++ b/app/services/merge_requests/create_service.rb
@@ -9,10 +9,7 @@ module MergeRequests
merge_request.source_branch = params[: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)
- end
+ create(merge_request)
end
def before_create(merge_request)