diff options
Diffstat (limited to 'app/services/repositories/destroy_rollback_service.rb')
-rw-r--r-- | app/services/repositories/destroy_rollback_service.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/repositories/destroy_rollback_service.rb b/app/services/repositories/destroy_rollback_service.rb new file mode 100644 index 00000000000..5ef4e11bf55 --- /dev/null +++ b/app/services/repositories/destroy_rollback_service.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class Repositories::DestroyRollbackService < Repositories::BaseService + def execute + # There is a possibility project does not have repository or wiki + return success unless repo_exists?(removal_path) + + # Flush the cache for both repositories. + ignore_git_errors { repository.before_delete } + + if mv_repository(removal_path, disk_path) + log_info(%Q{Repository "#{removal_path}" moved to "#{disk_path}" for repository "#{full_path}"}) + + success + else + move_error(removal_path) + end + end +end |