Class: Gitlab::Workhorse

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

Constant Summary collapse

SEND_DATA_HEADER =
'Gitlab-Workhorse-Send-Data'

Class Method Summary collapse

Class Method Details

.send_git_archive(project, ref, format) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gitlab/workhorse.rb', line 21

def send_git_archive(project, ref, format)
  format ||= 'tar.gz'
  format.downcase!
  params = project.repository.(ref, Gitlab.config.gitlab.repository_downloads_path, format)
  raise "Repository or ref not found" if params.empty?

  [
    SEND_DATA_HEADER,
    "git-archive:#{encode(params)}",
  ]
end

.send_git_blob(repository, blob) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/workhorse.rb', line 9

def send_git_blob(repository, blob)
  params = {
    'RepoPath' => repository.path_to_repo,
    'BlobId' => blob.id,
  }

  [
    SEND_DATA_HEADER,
    "git-blob:#{encode(params)}",
  ]
end