Commit 6e590af1 authored by Ahmad Sherif's avatar Ahmad Sherif

Check if repository already exists before trying to re-import it

parent 66870960
......@@ -29,7 +29,7 @@ module Projects
if unknown_url?
# In this case, we only want to import issues, not a repository.
create_repository
else
elsif !project.repository_exists?
import_repository
end
end
......
......@@ -110,7 +110,7 @@ describe Projects::ImportService, services: true do
end
it 'expires existence cache after error' do
allow_any_instance_of(Project).to receive(:repository_exists?).and_return(true)
allow_any_instance_of(Project).to receive(:repository_exists?).and_return(false, true)
expect_any_instance_of(Gitlab::Shell).to receive(:import_repository).with(project.repository_storage_path, project.path_with_namespace, project.import_url).and_raise(Gitlab::Shell::Error.new('Failed to import the repository'))
expect_any_instance_of(Repository).to receive(:expire_emptiness_caches).and_call_original
......
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