Class: Gitlab::Checks::ChangedBlobs

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/checks/changed_blobs.rb

Instance Method Summary collapse

Constructor Details

#initialize(project, revisions, bytes_limit:, with_paths: false) ⇒ ChangedBlobs

Returns a new instance of ChangedBlobs.



6
7
8
9
10
11
# File 'lib/gitlab/checks/changed_blobs.rb', line 6

def initialize(project, revisions, bytes_limit:, with_paths: false)
  @project = project
  @revisions = revisions
  @bytes_limit = bytes_limit
  @with_paths = with_paths
end

Instance Method Details

#execute(timeout:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gitlab/checks/changed_blobs.rb', line 13

def execute(timeout:)
  # List all blobs via `ListAllBlobs()` based on the existence of a
  # quarantine directory. If no directory exists, we use `ListBlobs()` instead.
  if ignore_alternate_directories?
    fetch_blobs_from_quarantined_repo(timeout: timeout)
  else
    # We use `--not --all --not revisions` to ensure we only get new blobs.
    project.repository.list_blobs(
      ['--not', '--all', '--not'] + revisions,
      bytes_limit: bytes_limit,
      with_paths: with_paths,
      dynamic_timeout: timeout
    ).to_a
  end
end