Skip to content
Snippets Groups Projects
Commit e3c36850 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Detect if we really want a new merge request properly

parent 358501df
No related branches found
No related tags found
No related merge requests found
Loading
@@ -92,7 +92,9 @@ module CreatesCommit
Loading
@@ -92,7 +92,9 @@ module CreatesCommit
end end
   
def create_merge_request? def create_merge_request?
params[:create_merge_request].present? # XXX: Even if the field is set, if we're checking the same branch
# as the target branch, we don't want to create a merge request.
params[:create_merge_request].present? && @ref != @target_branch
end end
   
# TODO: We should really clean this up # TODO: We should really clean this up
Loading
@@ -136,7 +138,8 @@ module CreatesCommit
Loading
@@ -136,7 +138,8 @@ module CreatesCommit
# branch instead of @target_branch. # branch instead of @target_branch.
return if return if
create_merge_request? && create_merge_request? &&
@mr_source_project.repository.branch_exists?(@target_branch) # XXX: Don't understand why rubocop prefers this indention
@mr_source_project.repository.branch_exists?(@target_branch)
   
@target_branch @target_branch
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment