Skip to content

Commit 79e9ce2

Browse files
tanayabhgitster
authored andcommitted
add a test for semantic errors in config files
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 <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 155ef25 commit 79e9ce2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/t1308-config-set.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,15 @@ test_expect_success 'proper error on error in custom config files' '
197197
test_cmp expect actual
198198
'
199199

200+
test_expect_success 'check line errors for malformed values' '
201+
mv .git/config .git/config.old &&
202+
test_when_finished "mv .git/config.old .git/config" &&
203+
cat >.git/config <<-\EOF &&
204+
[alias]
205+
br
206+
EOF
207+
test_expect_code 128 git br 2>result &&
208+
test_i18ngrep "fatal: .*alias\.br.*\.git/config.*line 2" result
209+
'
210+
200211
test_done

0 commit comments

Comments
 (0)