Commit 7b50f2eb authored by Mark Chao's avatar Mark Chao

Set @push early for EE

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.
parent d52af8b1
......@@ -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
......
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