Commit fa8f8343745deb7b677a525d12dc69435a98ae21
1 parent
9f595aa4
Exists in
master
and in
4 other branches
Fix import rake task and tests
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
lib/tasks/gitlab/import.rake
| ... | ... | @@ -15,15 +15,20 @@ namespace :gitlab do |
| 15 | 15 | git_base_path = Gitlab.config.gitolite.repos_path |
| 16 | 16 | repos_to_import = Dir.glob(git_base_path + '/*') |
| 17 | 17 | |
| 18 | + namespaces = Namespace.pluck(:path) | |
| 19 | + | |
| 18 | 20 | repos_to_import.each do |repo_path| |
| 19 | 21 | repo_name = File.basename repo_path |
| 20 | 22 | |
| 23 | + # Skip if group or user | |
| 24 | + next if namespaces.include?(repo_name) | |
| 25 | + | |
| 21 | 26 | # skip gitolite admin |
| 22 | 27 | next if repo_name == 'gitolite-admin.git' |
| 23 | 28 | |
| 24 | 29 | path = repo_name.sub(/\.git$/, '') |
| 25 | 30 | |
| 26 | - project = Project.find_by_path(path) | |
| 31 | + project = Project.find_with_namespace(path) | |
| 27 | 32 | |
| 28 | 33 | puts "Processing #{repo_name}".yellow |
| 29 | 34 | |
| ... | ... | @@ -34,8 +39,6 @@ namespace :gitlab do |
| 34 | 39 | |
| 35 | 40 | project_params = { |
| 36 | 41 | :name => path, |
| 37 | - :code => path, | |
| 38 | - :path => path, | |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | project = Project.create_by_user(project_params, user) | ... | ... |