summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-11-28 18:01:09 +0000
committerRémy Coutable <remy@rymai.me>2017-11-28 18:01:09 +0000
commitbecf29e3ab3463a8a1f3c6ed7bbfd7d2dcc49ea0 (patch)
treea56172dc723850b3baf3452a575bb77c461dbe64 /lib/gitlab
parent2081650afc6417daa5933146c0922ff622a958b7 (diff)
parent3c6a4d63636ba41dad0ce63cf536761fc3b5ef64 (diff)
downloadgitlab-ce-becf29e3ab3463a8a1f3c6ed7bbfd7d2dcc49ea0.tar.gz
Merge branch '40530-merge-request-generates-wrong-diff-when-branch-and-tag-have-the-same-name' into 'master'
Resolve "Merge request generates wrong diff when branch and tag have the same name" Closes #40530 See merge request gitlab-org/gitlab-ce!15591
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/git/repository.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index a6e7c410bdd..d399636bb28 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1046,9 +1046,15 @@ module Gitlab
end
def with_repo_tmp_commit(start_repository, start_branch_name, sha)
+ source_ref = start_branch_name
+
+ unless Gitlab::Git.branch_ref?(source_ref)
+ source_ref = "#{Gitlab::Git::BRANCH_REF_PREFIX}#{source_ref}"
+ end
+
tmp_ref = fetch_ref(
start_repository,
- source_ref: "#{Gitlab::Git::BRANCH_REF_PREFIX}#{start_branch_name}",
+ source_ref: source_ref,
target_ref: "refs/tmp/#{SecureRandom.hex}"
)