2018-11-09 18:39:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-16 02:08:30 +00:00
|
|
|
module Gitlab
|
|
|
|
module GitalyClient
|
|
|
|
module Util
|
2017-04-06 14:54:15 +00:00
|
|
|
class << self
|
2019-01-24 19:37:26 +00:00
|
|
|
def repository(repository_storage, relative_path, gl_repository, gl_project_path)
|
2018-03-30 09:19:46 +00:00
|
|
|
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'])
|
2017-10-05 14:51:31 +00:00
|
|
|
|
2017-04-06 14:54:15 +00:00
|
|
|
Gitaly::Repository.new(
|
|
|
|
storage_name: repository_storage,
|
2017-08-09 06:36:24 +00:00
|
|
|
relative_path: relative_path,
|
2017-12-19 16:45:58 +00:00
|
|
|
gl_repository: gl_repository.to_s,
|
2017-10-05 14:51:31 +00:00
|
|
|
git_object_directory: git_object_directory.to_s,
|
2018-12-23 07:34:35 +00:00
|
|
|
git_alternate_object_directories: git_alternate_object_directories,
|
2019-01-24 19:37:26 +00:00
|
|
|
gl_project_path: gl_project_path
|
2017-04-06 14:54:15 +00:00
|
|
|
)
|
|
|
|
end
|
2017-09-20 10:11:51 +00:00
|
|
|
|
2017-12-05 19:42:04 +00:00
|
|
|
def git_repository(gitaly_repository)
|
|
|
|
Gitlab::Git::Repository.new(gitaly_repository.storage_name,
|
|
|
|
gitaly_repository.relative_path,
|
2018-12-23 07:34:35 +00:00
|
|
|
gitaly_repository.gl_repository,
|
2019-01-24 19:37:26 +00:00
|
|
|
gitaly_repository.gl_project_path)
|
2017-12-05 19:42:04 +00:00
|
|
|
end
|
2017-02-16 02:08:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|