X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft1300-repo-config.sh;h=36e227b3bb25cb17dabc5e205e63056e7fd0b370;hb=bc62ca13c03a7f73b7091c26093c552776b749ee;hp=5f249f681e9324d7d35e3aee4dc9a834beff6c75;hpb=aa145bf6f1cb45ad66250c40da3cd708956cf71e;p=git.git diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 5f249f681..36e227b3b 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -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