X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft1300-repo-config.sh;h=728a965669e7a69014b950b8abbc672702caca27;hb=ed6ce4382b5cb34e98ca3db2f19de82a037da322;hp=0690e0edf4e758200d4febb1c7837b5c7059add6;hpb=e27d620e919f524ee0bfa0a4d1f35225d3cb867e;p=git.git diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 0690e0edf..728a96566 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -960,4 +960,35 @@ test_expect_success 'git -c complains about empty key and value' ' test_must_fail git -c "" rev-parse ' +# 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