diff options
author | James Lopez <james@jameslopez.es> | 2017-11-02 16:56:54 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-11-06 16:15:11 +0100 |
commit | 5d960efb962092c5134b96d913ceea013de55813 (patch) | |
tree | 9da7139f4382a7ac403fe9972f414515caf8bb9a | |
parent | a3ae3f7bf48c95ec11f70c10166a3fae2bf5b989 (diff) | |
download | gitlab-ce-5d960efb962092c5134b96d913ceea013de55813.tar.gz |
fixed spec, updated rake task
-rw-r--r-- | lib/gitlab/bare_repository_importer.rb | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/import.rake | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/gitlab/bare_repository_importer.rb b/lib/gitlab/bare_repository_importer.rb index 83ae4962abc..9c6abffbd8e 100644 --- a/lib/gitlab/bare_repository_importer.rb +++ b/lib/gitlab/bare_repository_importer.rb @@ -49,7 +49,7 @@ module Gitlab project = Projects::CreateService.new(user, name: project_name, - path: full_path, + path: project_name, namespace_id: group&.id).execute if project.persisted? diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index d227a0c8bdb..0eb7281abd0 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -2,23 +2,21 @@ namespace :gitlab do namespace :import do # How to use: # - # 1. copy the bare repos under the repository storage paths (commonly the default path is /home/git/repositories) - # 2. run: bundle exec rake gitlab:import:repos RAILS_ENV=production + # 1. copy the bare repos to a specific path that contain the group or subgroups structure as folders + # 2. run: bundle exec rake gitlab:import:repos[/path/to/repos] RAILS_ENV=production # # Notes: # * The project owner will set to the first administator of the system # * Existing projects will be skipped - # - # desc "GitLab | Import bare repositories from repositories -> storages into GitLab project instance" - task repos: :environment do - if Project.current_application_settings.hashed_storage_enabled - puts 'Cannot import repositories when Hashed Storage is enabled'.color(:red) + task :repos, [:import_path] => :environment do |_t, args| + unless args.import_path + puts 'Please specify an import path that contains the repositories'.color(:red) exit 1 end - Gitlab::BareRepositoryImporter.execute + Gitlab::BareRepositoryImporter.execute(import_path) end end end |