提交 6e590af1 编写于 作者: A Ahmad Sherif

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

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册