Support show-all-refs for git over HTTP
This commit is contained in:
parent
2d5c4532f1
commit
527f87dfdb
4 changed files with 25 additions and 5 deletions
|
@ -1 +1 @@
|
|||
3.2.0
|
||||
3.3.0
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Support show-all-refs for git over HTTP
|
||||
merge_request: 14834
|
||||
author:
|
||||
type: added
|
|
@ -16,14 +16,15 @@ module Gitlab
|
|||
SECRET_LENGTH = 32
|
||||
|
||||
class << self
|
||||
def git_http_ok(repository, is_wiki, user, action)
|
||||
def git_http_ok(repository, is_wiki, user, action, show_all_refs: false)
|
||||
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),
|
||||
GL_USERNAME: user&.username,
|
||||
RepoPath: repo_path
|
||||
RepoPath: repo_path,
|
||||
ShowAllRefs: show_all_refs
|
||||
}
|
||||
server = {
|
||||
address: Gitlab::GitalyClient.address(project.repository_storage),
|
||||
|
|
|
@ -268,7 +268,8 @@ describe Gitlab::Workhorse do
|
|||
GL_ID: "user-#{user.id}",
|
||||
GL_USERNAME: user.username,
|
||||
GL_REPOSITORY: "project-#{project.id}",
|
||||
RepoPath: repo_path
|
||||
RepoPath: repo_path,
|
||||
ShowAllRefs: false
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -282,7 +283,8 @@ describe Gitlab::Workhorse do
|
|||
GL_ID: "user-#{user.id}",
|
||||
GL_USERNAME: user.username,
|
||||
GL_REPOSITORY: "wiki-#{project.id}",
|
||||
RepoPath: repo_path
|
||||
RepoPath: repo_path,
|
||||
ShowAllRefs: false
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -324,6 +326,12 @@ describe Gitlab::Workhorse do
|
|||
|
||||
expect(subject).to include(gitaly_params)
|
||||
end
|
||||
|
||||
context 'show_all_refs enabled' do
|
||||
subject { described_class.git_http_ok(repository, false, user, action, show_all_refs: true) }
|
||||
|
||||
it { is_expected.to include(ShowAllRefs: true) }
|
||||
end
|
||||
end
|
||||
|
||||
context "when git_receive_pack action is passed" do
|
||||
|
@ -336,6 +344,12 @@ describe Gitlab::Workhorse do
|
|||
let(:action) { 'info_refs' }
|
||||
|
||||
it { expect(subject).to include(gitaly_params) }
|
||||
|
||||
context 'show_all_refs enabled' do
|
||||
subject { described_class.git_http_ok(repository, false, user, action, show_all_refs: true) }
|
||||
|
||||
it { is_expected.to include(ShowAllRefs: true) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when action passed is not supported by Gitaly' do
|
||||
|
|
Loading…
Reference in a new issue