summaryrefslogtreecommitdiff
path: root/t/t1300-repo-config.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-04-26 01:47:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-26 04:19:06 (GMT)
commit94a35b1aea88f1ad882cdd111e01410fb6d3eb46 (patch)
tree4157f0206ea05dcd97c62a0af8dc3ddc76a1fcbc /t/t1300-repo-config.sh
parentfdec2eb8ebbf995a77e2ab9971565c792b52944a (diff)
downloadgit-94a35b1aea88f1ad882cdd111e01410fb6d3eb46.zip
git-94a35b1aea88f1ad882cdd111e01410fb6d3eb46.tar.gz
git-94a35b1aea88f1ad882cdd111e01410fb6d3eb46.tar.bz2
config: reject bogus section names for --rename-section
You can feed junk to "git config --rename-section", which will result in a config file that git will not even parse (so you cannot fix it with git-config). We already have syntactic sanity checks when setting a variable; let's do the same for section names. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-xt/t1300-repo-config.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 36e227b..a477453 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -550,6 +550,14 @@ EOF
test_expect_success "rename succeeded" "test_cmp expect .git/config"
+test_expect_success 'renaming empty section name is rejected' '
+ test_must_fail git config --rename-section branch.zwei ""
+'
+
+test_expect_success 'renaming to bogus section is rejected' '
+ test_must_fail git config --rename-section branch.zwei "bogus name"
+'
+
cat >> .git/config << EOF
[branch "zwei"] a = 1 [branch "vier"]
EOF