未验证 提交 527f87df 编写于 作者: N Nick Thomas

Support show-all-refs for git over HTTP

上级 2d5c4532
---
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册