Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-03-26 23:10:05 +0400
committerJunio C Hamano <gitster@pobox.com>2012-03-26 23:10:05 +0400
commited6ce4382b5cb34e98ca3db2f19de82a037da322 (patch)
treee9065a1c320f0d6363667eef498a7fd56f7ec90c /t
parenta12c6b0149e3dadd0701dac4fd0ba2463d251650 (diff)
parent4b340593551217904d794cc0a8db55db89b5b066 (diff)
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
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-repo-config.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 0690e0edf4..728a965669 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