submodule: export sanitized GIT_CONFIG_PARAMETERS
Commit 14111fc (git: submodule honor -c credential.* from command line, 2016-02-29) taught git-submodule.sh to save the sanitized value of $GIT_CONFIG_PARAMETERS when clearing the environment for a submodule. However, it failed to export the result, meaning that it had no effect for any sub-programs. We didn't catch this in our initial tests because we checked only the "clone" case, which does not go through the shell script at all. Provoking "git submodule update" to do a fetch demonstrates the bug. Noticed-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 28, 2016 at 09:37 UTC
860cba61a3eac38151fd203547df7515023303e9
2 files changed
+18
git-submodule.sh
+1
@@ -200,6 +200,7 @@ sanitize_submodule_env()
200
sanitized_config=$(git submodule--helper sanitize-config)
201
clear_local_git_env
202
GIT_CONFIG_PARAMETERS=$sanitized_config
203
+ export GIT_CONFIG_PARAMETERS
204
}
205
206
#
t/t5550-http-fetch-dumb.sh
+17
@@ -112,6 +112,23 @@ test_expect_success 'cmdline credential config passes to submodule via clone' '
112
expect_askpass pass user@host
113
'
114
115
+test_expect_success 'cmdline credential config passes submodule update' '
116
+ # advance the submodule HEAD so that a fetch is required
117
+ git commit --allow-empty -m foo &&
118
+ git push "$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/repo.git" HEAD &&
119
+ sha1=$(git rev-parse HEAD) &&
120
+ git -C super-clone update-index --cacheinfo 160000,$sha1,sub &&
121
+
122
+ set_askpass wrong pass@host &&
123
+ test_must_fail git -C super-clone submodule update &&
124
+
125
+ set_askpass wrong pass@host &&
126
+ git -C super-clone \
127
+ -c "credential.$HTTPD_URL.username=user@host" \
128
+ submodule update &&
129
+ expect_askpass pass user@host
130
+'
131
+
132
test_expect_success 'fetch changes via http' '
133
echo content >>file &&
134
git commit -a -m two &&