Module: Gitlab::GitalyClient::Util

Defined in:
lib/gitlab/gitaly_client/util.rb

Class Method Summary collapse

Class Method Details

.git_repository(gitaly_repository) ⇒ Object


22
23
24
25
26
27
# File 'lib/gitlab/gitaly_client/util.rb', line 22

def git_repository(gitaly_repository)
  Gitlab::Git::Repository.new(gitaly_repository.storage_name,
                              gitaly_repository.relative_path,
                              gitaly_repository.gl_repository,
                              gitaly_repository.gl_project_path)
end

.repository(repository_storage, relative_path, gl_repository, gl_project_path) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/gitaly_client/util.rb', line 7

def repository(repository_storage, relative_path, gl_repository, gl_project_path)
  git_env = Gitlab::Git::HookEnv.all(gl_repository)
  git_object_directory = git_env['GIT_OBJECT_DIRECTORY_RELATIVE'].presence
  git_alternate_object_directories = Array.wrap(git_env['GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE'])

  Gitaly::Repository.new(
    storage_name: repository_storage,
    relative_path: relative_path,
    gl_repository: gl_repository.to_s,
    git_object_directory: git_object_directory.to_s,
    git_alternate_object_directories: git_alternate_object_directories,
    gl_project_path: gl_project_path
  )
end