2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module Gitlab
|
|
|
|
module GitalyClient
|
|
|
|
module Util
|
|
|
|
class << self
|
2019-03-02 22:35:43 +05:30
|
|
|
def repository(repository_storage, relative_path, gl_repository, gl_project_path)
|
2018-05-09 12:01:36 +05:30
|
|
|
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'])
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
Gitaly::Repository.new(
|
|
|
|
storage_name: repository_storage,
|
2018-03-17 18:26:18 +05:30
|
|
|
relative_path: relative_path,
|
|
|
|
gl_repository: gl_repository.to_s,
|
|
|
|
git_object_directory: git_object_directory.to_s,
|
2019-03-02 22:35:43 +05:30
|
|
|
git_alternate_object_directories: git_alternate_object_directories,
|
|
|
|
gl_project_path: gl_project_path
|
2018-03-17 18:26:18 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def git_repository(gitaly_repository)
|
|
|
|
Gitlab::Git::Repository.new(gitaly_repository.storage_name,
|
|
|
|
gitaly_repository.relative_path,
|
2019-03-02 22:35:43 +05:30
|
|
|
gitaly_repository.gl_repository,
|
|
|
|
gitaly_repository.gl_project_path)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|