author | Junio C Hamano <gitster@pobox.com> | |
Tue, 13 Mar 2012 19:35:53 +0000 (12:35 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 13 Mar 2012 19:35:53 +0000 (12:35 -0700) |
When "git config" diagnoses an error in a configuration file and
shows the line number for the offending line, it miscounted if the
error was at the end of line.
By Martin Stenberg
* ms/maint-config-error-at-eol-linecount:
config: report errors at the EOL with correct line number
Conflicts:
t/t1300-repo-config.sh
shows the line number for the offending line, it miscounted if the
error was at the end of line.
By Martin Stenberg
* ms/maint-config-error-at-eol-linecount:
config: report errors at the EOL with correct line number
Conflicts:
t/t1300-repo-config.sh
1 | 2 | |||
---|---|---|---|---|
config.c | patch | | diff1 | | diff2 | | blob | history |
t/t1300-repo-config.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc config.c
Simple merge
diff --cc t/t1300-repo-config.sh
index 5f249f681e9324d7d35e3aee4dc9a834beff6c75,23c8711d714eefa34f2bfc14b92818953aeafa49..36e227b3bb25cb17dabc5e205e63056e7fd0b370
+++ b/t/t1300-repo-config.sh
test_must_fail git -c "" rev-parse
'
+test_expect_success 'git config --edit works' '
+ git config -f tmp test.value no &&
+ echo test.value=yes >expect &&
+ GIT_EDITOR="echo [test]value=yes >" git config -f tmp --edit &&
+ git config -f tmp --list >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git config --edit respects core.editor' '
+ git config -f tmp test.value no &&
+ echo test.value=yes >expect &&
+ test_config core.editor "echo [test]value=yes >" &&
+ git config -f tmp --edit &&
+ git config -f tmp --list >actual &&
+ 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