From: Junio C Hamano Date: Tue, 13 Mar 2012 19:35:53 +0000 (-0700) Subject: Merge branch 'ms/maint-config-error-at-eol-linecount' X-Git-Tag: v1.7.10-rc1~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3f263099fca47c278e696fbc0f0d5525318eae0a;p=git.git Merge branch 'ms/maint-config-error-at-eol-linecount' 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 --- 3f263099fca47c278e696fbc0f0d5525318eae0a diff --cc t/t1300-repo-config.sh index 5f249f681,23c8711d7..36e227b3b --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -968,21 -928,35 +968,52 @@@ test_expect_success 'git -c complains a 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