Merge branch 'ms/maint-config-error-at-eol-linecount' into maint
* ms/maint-config-error-at-eol-linecount: config: report errors at the EOL with correct line number
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user