Commit bedd5769 authored by Stan Hu's avatar Stan Hu

Merge branch 'backport-ce-to-ee-merge' into 'master'

Backport of CE upstream - 2018-10-05 12:21 UTC

See merge request gitlab-org/gitlab-ce!22154
parents 1239629c 9f9cac67
...@@ -3,16 +3,17 @@ ...@@ -3,16 +3,17 @@
module MergeRequests module MergeRequests
class RefreshService < MergeRequests::BaseService class RefreshService < MergeRequests::BaseService
def execute(oldrev, newrev, ref) def execute(oldrev, newrev, ref)
@push = Gitlab::Git::Push.new(@project, oldrev, newrev, ref) push = Gitlab::Git::Push.new(@project, oldrev, newrev, ref)
return true unless push.branch_push?
return true unless @push.branch_push? refresh_merge_requests!(push)
refresh_merge_requests!
end end
private private
def refresh_merge_requests! def refresh_merge_requests!(push)
@push = push
Gitlab::GitalyClient.allow_n_plus_1_calls(&method(:find_new_commits)) Gitlab::GitalyClient.allow_n_plus_1_calls(&method(:find_new_commits))
# Be sure to close outstanding MRs before reloading them to avoid generating an # Be sure to close outstanding MRs before reloading them to avoid generating an
# empty diff during a manual merge # empty diff during a manual merge
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
class Push class Push
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
attr_reader :oldrev, :newrev attr_reader :ref, :oldrev, :newrev
def initialize(project, oldrev, newrev, ref) def initialize(project, oldrev, newrev, ref)
@project = project @project = project
......
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