Merge branch 'rs/unpack-trees-leakfix'
[gitweb.git] / t / t1300-repo-config.sh
index 5f249f681e9324d7d35e3aee4dc9a834beff6c75..36e227b3bb25cb17dabc5e205e63056e7fd0b370 100755 (executable)
@@ -985,4 +985,35 @@ test_expect_success 'git config --edit respects core.editor' '
        test_cmp expect actual
 '
 
+# malformed configuration files
+test_expect_success 'barf on syntax error' '
+       cat >.git/config <<-\EOF &&
+       # broken section line
+       [section]
+       key garbage
+       EOF
+       test_must_fail git config --get section.key >actual 2>error &&
+       grep " line 3 " error
+'
+
+test_expect_success 'barf on incomplete section header' '
+       cat >.git/config <<-\EOF &&
+       # broken section line
+       [section
+       key = value
+       EOF
+       test_must_fail git config --get section.key >actual 2>error &&
+       grep " line 2 " error
+'
+
+test_expect_success 'barf on incomplete string' '
+       cat >.git/config <<-\EOF &&
+       # broken section line
+       [section]
+       key = "value string
+       EOF
+       test_must_fail git config --get section.key >actual 2>error &&
+       grep " line 3 " error
+'
+
 test_done