Skip to content

Commit

Permalink
add a test for semantic errors in config files
Browse files Browse the repository at this point in the history
Semantic errors (for example, for alias.* variables NULL values are
not allowed) in configuration files cause a die printing the line
number and file name of the offending value.

Add a test documenting that such errors cause a die printing the
accurate line number and file name.

Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Tanay Abhra authored and Junio C Hamano committed Aug 7, 2014
1 parent 155ef25 commit 79e9ce2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions t/t1308-config-set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,15 @@ test_expect_success 'proper error on error in custom config files' '
test_cmp expect actual
'

test_expect_success 'check line errors for malformed values' '
mv .git/config .git/config.old &&
test_when_finished "mv .git/config.old .git/config" &&
cat >.git/config <<-\EOF &&
[alias]
br
EOF
test_expect_code 128 git br 2>result &&
test_i18ngrep "fatal: .*alias\.br.*\.git/config.*line 2" result
'

test_done

0 comments on commit 79e9ce2

Please sign in to comment.