summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-03-06 06:21:44 +0100
committerGabriel Mazetto <brodock@gmail.com>2017-03-08 19:42:21 +0100
commit26fa716dd2c1204b0cf4dc74e4c0a150f565a7ff (patch)
tree3e6d2069a724c43ed937151857626101e1bcd353 /lib
parent8707db80d67942f9fe38050a4bb51a3213e03fb0 (diff)
downloadgitlab-ce-26fa716dd2c1204b0cf4dc74e4c0a150f565a7ff.tar.gz
Fix name colision when importing GitHub pull requests from forked repositories
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/github_import/pull_request_formatter.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb
index 4ea0200e89b..e1224d03498 100644
--- a/lib/gitlab/github_import/pull_request_formatter.rb
+++ b/lib/gitlab/github_import/pull_request_formatter.rb
@@ -38,7 +38,11 @@ module Gitlab
def source_branch_name
@source_branch_name ||= begin
- source_branch_exists? ? source_branch_ref : "pull/#{number}/#{source_branch_ref}"
+ if source_branch.repo.id != target_branch.repo.id
+ "pull/#{number}/#{source_branch.repo.full_name}/#{source_branch_ref}"
+ else
+ source_branch_exists? ? source_branch_ref : "pull/#{number}/#{source_branch_ref}"
+ end
end
end