Skip to content

Commit 5459268

Browse files
jonathantanmygitster
authored andcommitted
upload-pack: read config when serving protocol v2
The upload-pack code paths never call git_config() with upload_pack_config() when protocol v2 is used, causing options like uploadpack.packobjectshook to not take effect. Ensure that this function is called. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7cc6ed2 commit 5459268

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

t/t5702-protocol-v2.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,20 @@ test_expect_success 'ref advertisment is filtered during fetch using protocol v2
201201
! grep "refs/tags/three" log
202202
'
203203

204+
test_expect_success 'upload-pack respects config using protocol v2' '
205+
git init server &&
206+
write_script server/.git/hook <<-\EOF &&
207+
touch hookout
208+
"$@"
209+
EOF
210+
test_commit -C server one &&
211+
212+
test_config_global uploadpack.packobjectshook ./hook &&
213+
test_path_is_missing server/.git/hookout &&
214+
git -c protocol.version=2 clone "file://$(pwd)/server" client &&
215+
test_path_is_file server/.git/hookout
216+
'
217+
204218
# Test protocol v2 with 'http://' transport
205219
#
206220
. "$TEST_DIRECTORY"/lib-httpd.sh

upload-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,8 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys,
13761376
enum fetch_state state = FETCH_PROCESS_ARGS;
13771377
struct upload_pack_data data;
13781378

1379+
git_config(upload_pack_config, NULL);
1380+
13791381
upload_pack_data_init(&data);
13801382
use_sideband = LARGE_PACKET_MAX;
13811383

0 commit comments

Comments
 (0)