diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2017-09-01 15:01:50 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-09-01 15:01:50 +0300 |
commit | 0187018e482f842704aa2cdc2f81375c859ec824 (patch) | |
tree | b91b3e0ce3fe763d09ea3ead63392b212936ef42 /app/services/projects/after_import_service.rb | |
parent | 7d3e888d069c3035b25f0dc8ff5efc8e52063db9 (diff) |
Simplify Git interactions in AfterImportService
Diffstat (limited to 'app/services/projects/after_import_service.rb')
-rw-r--r-- | app/services/projects/after_import_service.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/app/services/projects/after_import_service.rb b/app/services/projects/after_import_service.rb index e6a68d983ef..3047268b2d1 100644 --- a/app/services/projects/after_import_service.rb +++ b/app/services/projects/after_import_service.rb @@ -1,7 +1,6 @@ module Projects class AfterImportService - RESERVED_REFS_REGEXP = - %r{\Arefs/(?:#{Regexp.union(*Repository::RESERVED_REFS_NAMES)})/} + RESERVED_REF_PREFIXES = Repository::RESERVED_REFS_NAMES.map { |n| File.join('refs', n, '/') } def initialize(project) @project = project @@ -9,7 +8,7 @@ module Projects def execute Projects::HousekeepingService.new(@project).execute do - repository.delete_refs(*garbage_refs) + repository.delete_all_refs_except(RESERVED_REF_PREFIXES) end rescue Projects::HousekeepingService::LeaseTaken => e Rails.logger.info( @@ -18,10 +17,6 @@ module Projects private - def garbage_refs - @garbage_refs ||= repository.all_ref_names_except(RESERVED_REFS_REGEXP) - end - def repository @repository ||= @project.repository end |