diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-11-15 18:46:08 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-11-23 18:59:50 +0300 |
commit | 0e6beaf50c9233ca03083691856dea2883f71773 (patch) | |
tree | 44e8f6d85ab86f747cf5ec88c42a85782fb33a8e /lib/gitlab/github_import | |
parent | 7084c096732dcd041fbdcd22ba17233941683c04 (diff) |
Clean up repository fetch and mirror methods
Diffstat (limited to 'lib/gitlab/github_import')
-rw-r--r-- | lib/gitlab/github_import/importer/repository_importer.rb | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/gitlab/github_import/importer/repository_importer.rb b/lib/gitlab/github_import/importer/repository_importer.rb index 0b67fc8db73..7b1994de012 100644 --- a/lib/gitlab/github_import/importer/repository_importer.rb +++ b/lib/gitlab/github_import/importer/repository_importer.rb @@ -45,27 +45,14 @@ module Gitlab def import_repository project.ensure_repository - configure_repository_remote - - project.repository.fetch_remote('github', forced: true) + fetch_refs = Gitlab::GithubImport.fetch_refs + project.repository.fetch_as_mirror(project.import_url, fetch_refs: fetch_refs, forced: true, remote_name: 'github') true rescue Gitlab::Git::Repository::NoRepository, Gitlab::Shell::Error => e fail_import("Failed to import the repository: #{e.message}") end - def configure_repository_remote - return if project.repository.remote_exists?('github') - - project.repository.add_remote('github', project.import_url) - project.repository.set_import_remote_as_mirror('github') - - project.repository.add_remote_fetch_config( - 'github', - '+refs/pull/*/head:refs/merge-requests/*/head' - ) - end - def import_wiki_repository wiki_path = "#{project.disk_path}.wiki" wiki_url = project.import_url.sub(/\.git\z/, '.wiki.git') |