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