]> git.ipfire.org Git - thirdparty/git.git/commitdiff
upload-pack: read config when serving protocol v2
authorJonathan Tan <jonathantanmy@google.com>
Thu, 3 May 2018 23:46:55 +0000 (16:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 6 May 2018 04:17:19 +0000 (13:17 +0900)
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>
t/t5702-protocol-v2.sh
upload-pack.c

index 56f7c3c326cc045da5d443ff9ad1cb5653fcf21f..abb15cd6de5481c0f037444b948eebf11b0ee218 100755 (executable)
@@ -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_path_is_missing server/.git/hookout &&
+       git -c protocol.version=2 clone "file://$(pwd)/server" client &&
+       test_path_is_file server/.git/hookout
+'
+
 # Test protocol v2 with 'http://' transport
 #
 . "$TEST_DIRECTORY"/lib-httpd.sh
index c4456bb88a83a356c741fef014a711e11200f5a7..113edd32d4e8cd4f6f5dcccc92e872b4b0bb06ca 100644 (file)
@@ -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;