summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-05-15 14:26:39 +0000
committerDouwe Maan <douwe@gitlab.com>2017-05-15 14:26:39 +0000
commit915f1bcdaf56c5633bf3bbb8c8989298dd2685e9 (patch)
tree4e31e6020af0b082e61ffd0a06c2e69dd0f2b512
parentdb46475821c4546438797a5580a479ca73a862ba (diff)
parent851a8b1f739d045076767497db5f89d99034183e (diff)
downloadgitlab-ce-915f1bcdaf56c5633bf3bbb8c8989298dd2685e9.tar.gz
Merge branch 'fix-github-import' into 'master'
Fix token interpolation when setting the Github remote See merge request !11311
-rw-r--r--changelogs/unreleased/fix-github-import.yml4
-rw-r--r--lib/github/import.rb5
2 files changed, 8 insertions, 1 deletions
diff --git a/changelogs/unreleased/fix-github-import.yml b/changelogs/unreleased/fix-github-import.yml
new file mode 100644
index 00000000000..3a57152f7a8
--- /dev/null
+++ b/changelogs/unreleased/fix-github-import.yml
@@ -0,0 +1,4 @@
+---
+title: Fix token interpolation when setting the Github remote
+merge_request:
+author:
diff --git a/lib/github/import.rb b/lib/github/import.rb
index 06beb607a3e..9c7eb965f93 100644
--- a/lib/github/import.rb
+++ b/lib/github/import.rb
@@ -1,4 +1,5 @@
require_relative 'error'
+
module Github
class Import
include Gitlab::ShellAdapter
@@ -6,6 +7,7 @@ module Github
class MergeRequest < ::MergeRequest
self.table_name = 'merge_requests'
+ self.reset_callbacks :create
self.reset_callbacks :save
self.reset_callbacks :commit
self.reset_callbacks :update
@@ -16,6 +18,7 @@ module Github
self.table_name = 'issues'
self.reset_callbacks :save
+ self.reset_callbacks :create
self.reset_callbacks :commit
self.reset_callbacks :update
self.reset_callbacks :validate
@@ -79,7 +82,7 @@ module Github
def fetch_repository
begin
project.create_repository unless project.repository.exists?
- project.repository.add_remote('github', "https://{options.fetch(:token)}@github.com/#{repo}.git")
+ project.repository.add_remote('github', "https://#{options.fetch(:token)}@github.com/#{repo}.git")
project.repository.set_remote_as_mirror('github')
project.repository.fetch_remote('github', forced: true)
rescue Gitlab::Shell::Error => e