debian-mirror-gitlab/app/services/projects/after_import_service.rb

27 lines
707 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
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
2019-05-30 16:15:17 +05:30
Projects::HousekeepingService.new(@project).execute do
2018-03-17 18:26:18 +05:30
repository.delete_all_refs_except(RESERVED_REF_PREFIXES)
end
rescue Projects::HousekeepingService::LeaseTaken => e
2019-09-30 21:07:59 +05:30
Rails.logger.info( # rubocop:disable Gitlab/RailsLogger
2018-03-17 18:26:18 +05:30
"Could not perform housekeeping for project #{@project.full_path} (#{@project.id}): #{e}")
end
private
def repository
@repository ||= @project.repository
end
end
end