Commit 699986bb authored by Lin Jen-Shin's avatar Lin Jen-Shin

Extract a do_execute method to be overridden

This way we don't have to duplicate the guard
parent a6f7112c
......@@ -5,6 +5,12 @@ module MergeRequests
def execute(oldrev, newrev, ref)
return true unless Gitlab::Git.branch_ref?(ref)
do_execute(oldrev, newrev, ref)
end
private
def do_execute(oldrev, newrev, ref)
@oldrev, @newrev = oldrev, newrev
@branch_name = Gitlab::Git.ref_name(ref)
......@@ -30,8 +36,6 @@ module MergeRequests
true
end
private
def close_upon_missing_source_branch_ref
# MergeRequest#reload_diff ignores not opened MRs. This means it won't
# create an `empty` diff for `closed` MRs without a source branch, keeping
......
......@@ -3,15 +3,13 @@ module EE
module RefreshService
extend ::Gitlab::Utils::Override
override :execute
def execute(oldrev, newrev, ref)
return true unless ::Gitlab::Git.branch_ref?(ref)
private
override :do_execute
def do_execute(oldrev, newrev, ref)
super && reset_approvals_for_merge_requests(ref, newrev)
end
private
# Note: Closed merge requests also need approvals reset.
def reset_approvals_for_merge_requests(ref, newrev)
branch_name = ::Gitlab::Git.ref_name(ref)
......
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