Skip to content

Commit 2a2b52b

Browse files
committed
submodule: ensure that -c http.extraheader is heeded
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 1414f48 commit 2a2b52b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,16 @@ test_expect_success 'custom http headers' '
287287
fetch "$HTTPD_URL/smart_headers/repo.git" &&
288288
git -c http.extraheader="x-magic-one: abra" \
289289
-c http.extraheader="x-magic-two: cadabra" \
290-
fetch "$HTTPD_URL/smart_headers/repo.git"
290+
fetch "$HTTPD_URL/smart_headers/repo.git" &&
291+
git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
292+
git config -f .gitmodules submodule.sub.path sub &&
293+
git config -f .gitmodules submodule.sub.url \
294+
"$HTTPD_URL/smart_headers/repo.git" &&
295+
git submodule init sub &&
296+
test_must_fail git submodule update sub &&
297+
git -c http.extraheader="x-magic-one: abra" \
298+
-c http.extraheader="x-magic-two: cadabra" \
299+
submodule update sub
291300
'
292301

293302
stop_httpd

0 commit comments

Comments
 (0)