summaryrefslogtreecommitdiff
path: root/t/t1300-repo-config.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-27 18:34:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-27 18:34:02 (GMT)
commit5aebb3e0ef7f06358d1ca224247a5fbc12e99ccc (patch)
tree0f87dd2f664fce3db950d422073eb914563b127b /t/t1300-repo-config.sh
parentd7db100c18cf6ecdbe724938503b644e3ac8cde9 (diff)
parentddbbf8eb25065720eefeb31e22f668931fca815b (diff)
downloadgit-5aebb3e0ef7f06358d1ca224247a5fbc12e99ccc.zip
git-5aebb3e0ef7f06358d1ca224247a5fbc12e99ccc.tar.gz
git-5aebb3e0ef7f06358d1ca224247a5fbc12e99ccc.tar.bz2
Merge branch 'jk/sq-dequote-on-bogus-input'
Code to unquote single-quoted string (used in the parser for configuration files, etc.) did not diagnose bogus input correctly and produced bogus results instead. * jk/sq-dequote-on-bogus-input: sq_dequote: fix extra consumption of source string
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-xt/t1300-repo-config.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index cbeb9be..4f8e6f5 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -1206,6 +1206,29 @@ test_expect_success 'git -c is not confused by empty environment' '
GIT_CONFIG_PARAMETERS="" git -c x.one=1 config --list
'
+sq="'"
+test_expect_success 'detect bogus GIT_CONFIG_PARAMETERS' '
+ cat >expect <<-\EOF &&
+ env.one one
+ env.two two
+ EOF
+ GIT_CONFIG_PARAMETERS="${sq}env.one=one${sq} ${sq}env.two=two${sq}" \
+ git config --get-regexp "env.*" >actual &&
+ test_cmp expect actual &&
+
+ cat >expect <<-EOF &&
+ env.one one${sq}
+ env.two two
+ EOF
+ GIT_CONFIG_PARAMETERS="${sq}env.one=one${sq}\\$sq$sq$sq ${sq}env.two=two${sq}" \
+ git config --get-regexp "env.*" >actual &&
+ test_cmp expect actual &&
+
+ test_must_fail env \
+ GIT_CONFIG_PARAMETERS="${sq}env.one=one${sq}\\$sq ${sq}env.two=two${sq}" \
+ git config --get-regexp "env.*"
+'
+
test_expect_success 'git config --edit works' '
git config -f tmp test.value no &&
echo test.value=yes >expect &&