Fix Rubocop offenses

parent 44954c50
...@@ -160,8 +160,7 @@ module Github ...@@ -160,8 +160,7 @@ module Github
next unless merge_request.new_record? && pull_request.valid? next unless merge_request.new_record? && pull_request.valid?
begin begin
restore_source_branch(pull_request) unless pull_request.source_branch_exists? restore_branches(pull_request)
restore_target_branch(pull_request) unless pull_request.target_branch_exists?
author_id = user_id(pull_request.author, project.creator_id) author_id = user_id(pull_request.author, project.creator_id)
merge_request.iid = pull_request.iid merge_request.iid = pull_request.iid
...@@ -310,6 +309,11 @@ module Github ...@@ -310,6 +309,11 @@ module Github
end end
end end
def restore_branches(pull_request)
restore_source_branch(pull_request) unless pull_request.source_branch_exists?
restore_target_branch(pull_request) unless pull_request.target_branch_exists?
end
def restore_source_branch(pull_request) def restore_source_branch(pull_request)
repository.create_branch(pull_request.source_branch_name, pull_request.source_branch_sha) repository.create_branch(pull_request.source_branch_name, pull_request.source_branch_sha)
end end
......
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