summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/repository_cleaner.rb
blob: 9dd0ddfb44b5cc7ec04f2211fae373b9a6444922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Gitlab
  module Git
    class RepositoryCleaner
      include Gitlab::Git::WrapsGitalyErrors

      attr_reader :repository

      # 'repository' is a Gitlab::Git::Repository
      def initialize(repository)
        @repository = repository
      end

      def apply_bfg_object_map_stream(io, &blk)
        wrapped_gitaly_errors do
          gitaly_cleanup_client.apply_bfg_object_map_stream(io, &blk)
        end
      end

      private

      def gitaly_cleanup_client
        @gitaly_cleanup_client ||= Gitlab::GitalyClient::CleanupService.new(repository)
      end
    end
  end
end