diff options
author | Sean McGivern <sean@gitlab.com> | 2017-11-24 11:58:05 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-11-28 17:01:38 +0000 |
commit | 3c6a4d63636ba41dad0ce63cf536761fc3b5ef64 (patch) | |
tree | 9fafbe59d20f94c22e27dd35a8ddd1297ca6a54b /app/controllers/projects/merge_requests/creations_controller.rb | |
parent | 7c1e54d58d7ee0308b865d9563f1dfeb54568e16 (diff) | |
download | gitlab-ce-3c6a4d63636ba41dad0ce63cf536761fc3b5ef64.tar.gz |
Ensure MRs always use branch refs for comparison
If a merge request was created with a branch name that also matched a tag name,
we'd generate a comparison to or from the tag respectively, rather than the
branch. Merging would still use the branch, of course.
To avoid this, ensure that when we get the branch heads, we prepend the
reference prefix for branches, which will ensure that we generate the correct
comparison.
Diffstat (limited to 'app/controllers/projects/merge_requests/creations_controller.rb')
-rw-r--r-- | app/controllers/projects/merge_requests/creations_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb index 764a9c7111e..1511fc08c89 100644 --- a/app/controllers/projects/merge_requests/creations_controller.rb +++ b/app/controllers/projects/merge_requests/creations_controller.rb @@ -65,7 +65,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap if params[:ref].present? @ref = params[:ref] - @commit = @repository.commit("refs/heads/#{@ref}") + @commit = @repository.commit(Gitlab::Git::BRANCH_REF_PREFIX + @ref) end render layout: false @@ -76,7 +76,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap if params[:ref].present? @ref = params[:ref] - @commit = @target_project.commit("refs/heads/#{@ref}") + @commit = @target_project.commit(Gitlab::Git::BRANCH_REF_PREFIX + @ref) end render layout: false |