diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-01-06 22:49:23 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-01-06 22:49:23 +0800 |
commit | e3c36850a618ee2f7f9087b681e62d8a50e7b1b1 (patch) | |
tree | 9258174000a3876148def79f137463dbbf1227d1 /app/controllers/concerns/creates_commit.rb | |
parent | 358501df2d3229f68be700d2fc57cd3c3e7e5042 (diff) | |
download | gitlab-ce-e3c36850a618ee2f7f9087b681e62d8a50e7b1b1.tar.gz |
Detect if we really want a new merge request properly
Diffstat (limited to 'app/controllers/concerns/creates_commit.rb')
-rw-r--r-- | app/controllers/concerns/creates_commit.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index 516b1cac6ef..646d922cb24 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -92,7 +92,9 @@ module CreatesCommit end 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 # TODO: We should really clean this up @@ -136,7 +138,8 @@ module CreatesCommit # branch instead of @target_branch. return if 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 end |