submodule: ensure that -c http.extraheader is heeded
[gitweb.git] / t / t5550-http-fetch-dumb.sh
index e8e91bbb6d9fc5cabe9ce4e54ee76d88a89f8ed5..3484b6f0f3cf04a9cf831a5d91c31486efebcc38 100755 (executable)
@@ -112,6 +112,34 @@ test_expect_success 'cmdline credential config passes to submodule via clone' '
        expect_askpass pass user@host
 '
 
+test_expect_success 'cmdline credential config passes submodule via fetch' '
+       set_askpass wrong pass@host &&
+       test_must_fail git -C super-clone fetch --recurse-submodules &&
+
+       set_askpass wrong pass@host &&
+       git -C super-clone \
+           -c "credential.$HTTPD_URL.username=user@host" \
+           fetch --recurse-submodules &&
+       expect_askpass pass user@host
+'
+
+test_expect_success 'cmdline credential config passes submodule update' '
+       # advance the submodule HEAD so that a fetch is required
+       git commit --allow-empty -m foo &&
+       git push "$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/repo.git" HEAD &&
+       sha1=$(git rev-parse HEAD) &&
+       git -C super-clone update-index --cacheinfo 160000,$sha1,sub &&
+
+       set_askpass wrong pass@host &&
+       test_must_fail git -C super-clone submodule update &&
+
+       set_askpass wrong pass@host &&
+       git -C super-clone \
+           -c "credential.$HTTPD_URL.username=user@host" \
+           submodule update &&
+       expect_askpass pass user@host
+'
+
 test_expect_success 'fetch changes via http' '
        echo content >>file &&
        git commit -a -m two &&