Class: LfsPointersFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/lfs_pointers_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(repository, path) ⇒ LfsPointersFinder

Returns a new instance of LfsPointersFinder.



4
5
6
7
# File 'app/finders/lfs_pointers_finder.rb', line 4

def initialize(repository, path)
  @repository = repository
  @path = path
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/finders/lfs_pointers_finder.rb', line 9

def execute
  return [] unless ref

  blob_ids = tree.blobs.map(&:id)

  # When current endpoint is a Blob then `tree.blobs` will be empty, it means we need to analyze
  # the current Blob in order to determine if it's a LFS object
  blob_ids = Array.wrap(current_blob&.id) if blob_ids.empty?

  Gitlab::Git::Blob.batch_lfs_pointers(repository, blob_ids).map(&:id)
end