Commit 01a74127 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Dont import repo if exists

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 0f4ad24f
...@@ -92,6 +92,9 @@ class GitlabProjects ...@@ -92,6 +92,9 @@ class GitlabProjects
# Import project via git clone --bare # Import project via git clone --bare
# URL must be publicly cloneable # URL must be publicly cloneable
def import_project def import_project
# Skip import if repo already exists
return false if File.exists?(full_path)
@source = ARGV.shift @source = ARGV.shift
# timeout for clone # timeout for clone
......
...@@ -213,6 +213,15 @@ describe GitlabProjects do ...@@ -213,6 +213,15 @@ describe GitlabProjects do
end end
end end
context 'already exists' do
let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') }
it 'should import only once' do
gl_projects.exec.should be_true
gl_projects.exec.should be_false
end
end
context 'timeout' do context 'timeout' do
let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/gitlabhq/gitlabhq.git', '1') } let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/gitlabhq/gitlabhq.git', '1') }
......
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