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 <jonathantanmy@xxxxxxxxxx> --- t/t5702-protocol-v2.sh | 14 ++++++++++++++ upload-pack.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index 56f7c3c32..0ead99993 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -201,6 +201,20 @@ test_expect_success 'ref advertisment is filtered during fetch using protocol v2 ! grep "refs/tags/three" log ' +test_expect_success 'upload-pack respects config using protocol v2' ' + git init server && + write_script server/.git/hook <<-\EOF && + touch hookout + "$@" + EOF + test_commit -C server one && + + test_config_global uploadpack.packobjectshook ./hook && + test ! -f server/.git/hookout && + GIT_TRACE=/tmp/y git -c protocol.version=2 clone "file://$(pwd)/server" client && + test -f server/.git/hookout +' + # Test protocol v2 with 'http://' transport # . "$TEST_DIRECTORY"/lib-httpd.sh diff --git a/upload-pack.c b/upload-pack.c index c4456bb88..113edd32d 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -1376,6 +1376,8 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys, enum fetch_state state = FETCH_PROCESS_ARGS; struct upload_pack_data data; + git_config(upload_pack_config, NULL); + upload_pack_data_init(&data); use_sideband = LARGE_PACKET_MAX; -- 2.17.0.441.gb46fe60e1d-goog