diff options
Diffstat (limited to 'lib/gitlab/import_export/repo_restorer.rb')
-rw-r--r-- | lib/gitlab/import_export/repo_restorer.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/import_export/repo_restorer.rb b/lib/gitlab/import_export/repo_restorer.rb index 9e10e7aea13..f808e30bd6e 100644 --- a/lib/gitlab/import_export/repo_restorer.rb +++ b/lib/gitlab/import_export/repo_restorer.rb @@ -14,10 +14,10 @@ module Gitlab def restore return true unless File.exist?(path_to_bundle) + ensure_repository_does_not_exist! + repository.create_from_bundle(path_to_bundle) rescue => e - Repositories::DestroyService.new(repository).execute - shared.error(e) false end @@ -25,6 +25,16 @@ module Gitlab private attr_accessor :repository, :path_to_bundle, :shared + + def ensure_repository_does_not_exist! + if repository.exists? + shared.logger.info( + message: %Q{Deleting existing "#{repository.path}" to re-import it.} + ) + + Repositories::DestroyService.new(repository).execute + end + end end end end |