Commit fa8f8343745deb7b677a525d12dc69435a98ae21

Authored by Dmitriy Zaporozhets
1 parent 9f595aa4

Fix import rake task and tests

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)
... ...
spec/requests/api/projects_spec.rb
... ... @@ -64,6 +64,7 @@ describe Gitlab::API do
64 64 post api("/projects", user), project
65 65  
66 66 project.each_pair do |k,v|
  67 + next if k == :path
67 68 json_response[k.to_s].should == v
68 69 end
69 70 end
... ...