Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-03-06 08:21:44 +0300
committerGabriel Mazetto <brodock@gmail.com>2017-03-08 21:42:21 +0300
commit26fa716dd2c1204b0cf4dc74e4c0a150f565a7ff (patch)
tree3e6d2069a724c43ed937151857626101e1bcd353 /lib/gitlab/github_import
parent8707db80d67942f9fe38050a4bb51a3213e03fb0 (diff)
Fix name colision when importing GitHub pull requests from forked repositories
Diffstat (limited to 'lib/gitlab/github_import')
-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