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 <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Tan committed May 3, 2018 at 16:46 UTC 5459268751941a71b32816902698376b7932cec5
2 files changed +16
t/t5702-protocol-v2.sh
+14
@@ -201,6 +201,20 @@ test_expect_success 'ref advertisment is filtered during fetch using protocol v2
201 ! grep "refs/tags/three" log
202 '
203
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 +
218 # Test protocol v2 with 'http://' transport
219 #
220 . "$TEST_DIRECTORY"/lib-httpd.sh
upload-pack.c
+2
@@ -1376,6 +1376,8 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys,
1376 enum fetch_state state = FETCH_PROCESS_ARGS;
1377 struct upload_pack_data data;
1378
1379 + git_config(upload_pack_config, NULL);
1380 +
1381 upload_pack_data_init(&data);
1382 use_sideband = LARGE_PACKET_MAX;
1383