diff options
Diffstat (limited to 'app/services/projects/after_import_service.rb')
-rw-r--r-- | app/services/projects/after_import_service.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/projects/after_import_service.rb b/app/services/projects/after_import_service.rb new file mode 100644 index 00000000000..3047268b2d1 --- /dev/null +++ b/app/services/projects/after_import_service.rb @@ -0,0 +1,24 @@ +module Projects + class AfterImportService + RESERVED_REF_PREFIXES = Repository::RESERVED_REFS_NAMES.map { |n| File.join('refs', n, '/') } + + def initialize(project) + @project = project + end + + def execute + Projects::HousekeepingService.new(@project).execute do + repository.delete_all_refs_except(RESERVED_REF_PREFIXES) + end + rescue Projects::HousekeepingService::LeaseTaken => e + Rails.logger.info( + "Could not perform housekeeping for project #{@project.full_path} (#{@project.id}): #{e}") + end + + private + + def repository + @repository ||= @project.repository + end + end +end |