summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2021-01-12 12:27:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-15 21:03:18 (GMT)
commit1ff21c05ba99ed2d0ade8318e3cb0c1a3f8d4b80 (patch)
tree5a5c333541cec7abf57326559fc958a556dadc7b /t
parentf9dbb64fadf599c588a39d2251bb3f9a2f7d572a (diff)
downloadgit-1ff21c05ba99ed2d0ade8318e3cb0c1a3f8d4b80.zip
git-1ff21c05ba99ed2d0ade8318e3cb0c1a3f8d4b80.tar.gz
git-1ff21c05ba99ed2d0ade8318e3cb0c1a3f8d4b80.tar.bz2
config: store "git -c" variables using more robust format
The previous commit added a new format for $GIT_CONFIG_PARAMETERS which is able to robustly handle subsections with "=" in them. Let's start writing the new format. Unfortunately, this does much less than you'd hope, because "git -c" itself has the same ambiguity problem! But it's still worth doing: - we've now pushed the problem from the inter-process communication into the "-c" command-line parser. This would free us up to later add an unambiguous format there (e.g., separate arguments like "git --config key value", etc). - for --config-env, the parser already disallows "=" in the environment variable name. So: git --config-env section.with=equals.key=ENVVAR will robustly set section.with=equals.key to the contents of $ENVVAR. The new test shows the improvement for --config-env. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-config.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index efdf2bf..cc68b42 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -1416,6 +1416,14 @@ test_expect_success 'git -c and --config-env override each other' '
test_cmp expect actual
'
+test_expect_success '--config-env handles keys with equals' '
+ echo value=with=equals >expect &&
+ ENVVAR=value=with=equals git \
+ --config-env=section.subsection=with=equals.key=ENVVAR \
+ config section.subsection=with=equals.key >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'git config --edit works' '
git config -f tmp test.value no &&
echo test.value=yes >expect &&