diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/internal.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gl_repository.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/workhorse.rb | 6 |
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index ddb2047f686..2a11790b215 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -44,7 +44,7 @@ module API # Project id to pass between components that don't share/don't have # access to the same filesystem mounts - response[:gl_repository] = "#{wiki? ? 'wiki' : 'project'}-#{project.id}" + response[:gl_repository] = Gitlab::GlRepository.gl_repository(project, wiki?) # Return the repository full path so that gitlab-shell has it when # handling ssh commands diff --git a/lib/gitlab/gl_repository.rb b/lib/gitlab/gl_repository.rb index 6997546049e..07c0abcce23 100644 --- a/lib/gitlab/gl_repository.rb +++ b/lib/gitlab/gl_repository.rb @@ -1,5 +1,9 @@ module Gitlab module GlRepository + def self.gl_repository(project, is_wiki) + "#{is_wiki ? 'wiki' : 'project'}-#{project.id}" + end + def self.parse(gl_repository) match_data = /\A(project|wiki)-([1-9][0-9]*)\z/.match(gl_repository) unless match_data diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index c551f939df1..8c5ad01e8c2 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -16,15 +16,17 @@ module Gitlab SECRET_LENGTH = 32 class << self - def git_http_ok(repository, user, action) + def git_http_ok(repository, is_wiki, user, action) + project = repository.project repo_path = repository.path_to_repo params = { GL_ID: Gitlab::GlId.gl_id(user), + GL_REPOSITORY: Gitlab::GlRepository.gl_repository(project, is_wiki), RepoPath: repo_path, } if Gitlab.config.gitaly.enabled - address = Gitlab::GitalyClient.get_address(repository.project.repository_storage) + address = Gitlab::GitalyClient.get_address(project.repository_storage) params[:Repository] = repository.gitaly_repository.to_h feature_enabled = case action.to_s |