Commit 1abf2018 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'jc-add-config-option-for-partial-clone' into 'master'

Add allowFilter and allowAnySHA1InWant for partial clones

See merge request gitlab-org/gitlab!16850
parents e5f4daea 2cdb73b3
---
title: Add allowFilter and allowAnySHA1InWant for partial clones
merge_request: 16850
author:
type: added
...@@ -78,6 +78,10 @@ module API ...@@ -78,6 +78,10 @@ module API
receive_max_input_size = Gitlab::CurrentSettings.receive_max_input_size.to_i receive_max_input_size = Gitlab::CurrentSettings.receive_max_input_size.to_i
if receive_max_input_size > 0 if receive_max_input_size > 0
payload[:git_config_options] << "receive.maxInputSize=#{receive_max_input_size.megabytes}" payload[:git_config_options] << "receive.maxInputSize=#{receive_max_input_size.megabytes}"
if Feature.enabled?(:gitaly_upload_pack_filter, project)
payload[:git_config_options] << "uploadpack.allowFilter=true" << "uploadpack.allowAnySHA1InWant=true"
end
end end
response_with_status(**payload) response_with_status(**payload)
......
...@@ -403,12 +403,30 @@ describe API::Internal::Base do ...@@ -403,12 +403,30 @@ describe API::Internal::Base do
end end
context 'when receive_max_input_size has been updated' do context 'when receive_max_input_size has been updated' do
it 'returns custom git config' do before do
allow(Gitlab::CurrentSettings).to receive(:receive_max_input_size) { 1 } allow(Gitlab::CurrentSettings).to receive(:receive_max_input_size) { 1 }
end
it 'returns custom git config' do
push(key, project) push(key, project)
expect(json_response["git_config_options"]).to be_present expect(json_response["git_config_options"]).to be_present
expect(json_response["git_config_options"]).to include("uploadpack.allowFilter=true")
expect(json_response["git_config_options"]).to include("uploadpack.allowAnySHA1InWant=true")
end
context 'when gitaly_upload_pack_filter feature flag is disabled' do
before do
stub_feature_flags(gitaly_upload_pack_filter: { enabled: false, thing: project })
end
it 'does not include allowFilter and allowAnySha1InWant in the git config options' do
push(key, project)
expect(json_response["git_config_options"]).to be_present
expect(json_response["git_config_options"]).not_to include("uploadpack.allowFilter=true")
expect(json_response["git_config_options"]).not_to include("uploadpack.allowAnySHA1InWant=true")
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment