]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule: ensure that -c http.extraheader is heeded
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 10 May 2016 07:08:56 +0000 (09:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 May 2016 19:56:28 +0000 (12:56 -0700)
To support this developer's use case of allowing build agents token-based
access to private repositories, we introduced the http.extraheader
feature, allowing extra HTTP headers to be sent along with every HTTP
request.

This patch verifies that we can configure these extra HTTP headers via the
command-line for use with `git submodule update`, too. Example: git -c
http.extraheader="Secret: Sauce" submodule update --init

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5551-http-fetch-smart.sh

index 43b257e7fd20e8e2e9f37aab74e863765578de29..2f375eb94d528baefad038ff5b07baf0fe08d1fc 100755 (executable)
@@ -287,7 +287,16 @@ test_expect_success 'custom http headers' '
                fetch "$HTTPD_URL/smart_headers/repo.git" &&
        git -c http.extraheader="x-magic-one: abra" \
            -c http.extraheader="x-magic-two: cadabra" \
-           fetch "$HTTPD_URL/smart_headers/repo.git"
+           fetch "$HTTPD_URL/smart_headers/repo.git" &&
+       git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
+       git config -f .gitmodules submodule.sub.path sub &&
+       git config -f .gitmodules submodule.sub.url \
+               "$HTTPD_URL/smart_headers/repo.git" &&
+       git submodule init sub &&
+       test_must_fail git submodule update sub &&
+       git -c http.extraheader="x-magic-one: abra" \
+           -c http.extraheader="x-magic-two: cadabra" \
+               submodule update sub
 '
 
 stop_httpd