Commit fa8f8343 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix import rake task and tests

parent 9f595aa4
...@@ -15,15 +15,20 @@ namespace :gitlab do ...@@ -15,15 +15,20 @@ namespace :gitlab do
git_base_path = Gitlab.config.gitolite.repos_path git_base_path = Gitlab.config.gitolite.repos_path
repos_to_import = Dir.glob(git_base_path + '/*') repos_to_import = Dir.glob(git_base_path + '/*')
namespaces = Namespace.pluck(:path)
repos_to_import.each do |repo_path| repos_to_import.each do |repo_path|
repo_name = File.basename repo_path repo_name = File.basename repo_path
# Skip if group or user
next if namespaces.include?(repo_name)
# skip gitolite admin # skip gitolite admin
next if repo_name == 'gitolite-admin.git' next if repo_name == 'gitolite-admin.git'
path = repo_name.sub(/\.git$/, '') path = repo_name.sub(/\.git$/, '')
project = Project.find_by_path(path) project = Project.find_with_namespace(path)
puts "Processing #{repo_name}".yellow puts "Processing #{repo_name}".yellow
...@@ -34,8 +39,6 @@ namespace :gitlab do ...@@ -34,8 +39,6 @@ namespace :gitlab do
project_params = { project_params = {
:name => path, :name => path,
:code => path,
:path => path,
} }
project = Project.create_by_user(project_params, user) project = Project.create_by_user(project_params, user)
......
...@@ -64,6 +64,7 @@ describe Gitlab::API do ...@@ -64,6 +64,7 @@ describe Gitlab::API do
post api("/projects", user), project post api("/projects", user), project
project.each_pair do |k,v| project.each_pair do |k,v|
next if k == :path
json_response[k.to_s].should == v json_response[k.to_s].should == v
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment