summaryrefslogtreecommitdiff
path: root/t/t1300-repo-config.sh
diff options
context:
space:
mode:
authorLibor Pechacek <lpechacek@suse.cz>2011-02-01 07:13:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-02-22 23:19:46 (GMT)
commit2169ddc056b56deba701cbbba28cdaf2e9821224 (patch)
tree63efb8d26f51e9c09752151e398dfb122eeb2053 /t/t1300-repo-config.sh
parentb09c53a3e331211fc0154de8ebb271e48f8c7ee5 (diff)
downloadgit-2169ddc056b56deba701cbbba28cdaf2e9821224.zip
git-2169ddc056b56deba701cbbba28cdaf2e9821224.tar.gz
git-2169ddc056b56deba701cbbba28cdaf2e9821224.tar.bz2
Disallow empty section and variable names
It is possible to break your repository config by creating an invalid key. The config parser in turn chokes on it: $ git init Initialized empty Git repository in /tmp/gittest/.git/ $ git config .foo false $ git config core.bare fatal: bad config file line 6 in .git/config This patch makes git-config reject keys which start or end with a dot and adds tests for these cases. Signed-off-by: Libor Pechacek <lpechacek@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-xt/t1300-repo-config.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index c3d91d1..53fb822 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -889,6 +889,10 @@ test_expect_success 'key sanity-checking' '
test_must_fail git config foo.1bar &&
test_must_fail git config foo."ba
z".bar &&
+ test_must_fail git config . false &&
+ test_must_fail git config .foo false &&
+ test_must_fail git config foo. false &&
+ test_must_fail git config .foo. false &&
git config foo.bar true &&
git config foo."ba =z".bar false
'