Check if repository already exists before trying to re-import it
This commit is contained in:
parent
66870960af
commit
6e590af148
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue