summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-11-07 11:06:02 +0800
committerMark Chao <mchao@gitlab.com>2018-11-07 11:38:45 +0800
commit7b50f2eb4a96bfc8565e53c0466582498930a314 (patch)
treea44d0ca8d88a2e740512632b3082a83f0cd707b9
parentd52af8b1c2041ecd4219f0ad320208afe3ebad16 (diff)
downloadgitlab-ce-ee-1012-assign-code-owner-as-approver.tar.gz
In EE, there is need to call `merge_requests_for_source_branch` before calling CE's `refresh_merge_requests, in order to obtain the old diffs. However that requires `@push`, initialized inside CE's refresh_merge_requests. However it can't be set early in EE, or static analysis would fail because use of instance variables in module is discouraged. So @push is set in execute instead.
-rw-r--r--app/services/merge_requests/refresh_service.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb
index 53768ff2cbe..5fe48da1cd6 100644
--- a/app/services/merge_requests/refresh_service.rb
+++ b/app/services/merge_requests/refresh_service.rb
@@ -2,18 +2,18 @@
module MergeRequests
class RefreshService < MergeRequests::BaseService
+ attr_reader :push
+
def execute(oldrev, newrev, ref)
- push = Gitlab::Git::Push.new(@project, oldrev, newrev, ref)
- return true unless push.branch_push?
+ @push = Gitlab::Git::Push.new(@project, oldrev, newrev, ref)
+ return true unless @push.branch_push?
- refresh_merge_requests!(push)
+ refresh_merge_requests!
end
private
- def refresh_merge_requests!(push)
- @push = push
-
+ def refresh_merge_requests!
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