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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-07 20:45:08 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-07 20:45:08 +0300
commitd4058995da7d60200300857bff8791377f72b0d6 (patch)
treeb39b4486184d1155a9c743fe2833378380f9046e /lib/tasks/import.rake
parentfd16c892556a345d43a5ffc1c7bbc28b63b0a49c (diff)
Fix rake test to import Github repositories
Diffstat (limited to 'lib/tasks/import.rake')
-rw-r--r--lib/tasks/import.rake11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 350afeb5c0b..15131fbf755 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -48,9 +48,16 @@ class NewImporter < ::Gitlab::GithubImport::Importer
begin
raise 'Blocked import URL.' if Gitlab::UrlBlocker.blocked_url?(project.import_url)
- gitlab_shell.import_repository(project.repository_storage_path, project.path_with_namespace, project.import_url)
+ project.create_repository
+ project.repository.add_remote(project.import_type, project.import_url)
+ project.repository.set_remote_as_mirror(project.import_type)
+ project.repository.fetch_remote(project.import_type, forced: true)
+ project.repository.remove_remote(project.import_type)
rescue => e
- project.repository.before_import if project.repository_exists?
+ # Expire cache to prevent scenarios such as:
+ # 1. First import failed, but the repo was imported successfully, so +exists?+ returns true
+ # 2. Retried import, repo is broken or not imported but +exists?+ still returns true
+ project.repository.expire_content_cache if project.repository_exists?
raise "Error importing repository #{project.import_url} into #{project.path_with_namespace} - #{e.message}"
end