diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-12-14 21:21:36 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-14 21:21:36 +0300 |
commit | 78abcff222d2d9cb05776bac39f7dc6a84b8f809 (patch) | |
tree | 622cf8ba301d0f32c8e56d669abfc0c76826be07 /t | |
parent | 3cf59784d42c4152a0b3de7bb7a75d0071e5f878 (diff) | |
parent | 644bb953ce3251f2868ece6b767949828fa32e44 (diff) |
Merge branch 'dd/help-autocorrect-never'
"git $cmd $args", when $cmd is not a recognised subcommand, by
default tries to see if $cmd is a typo of an existing subcommand
and optionally executes the corrected command if there is only one
possibility, depending on the setting of help.autocorrect; the
users can now disable the whole thing, including the cycles spent
to find a likely typo, by setting the configuration variable to
'never'.
* dd/help-autocorrect-never:
help.c: help.autocorrect=never means "do not compute suggestions"
Diffstat (limited to 't')
-rwxr-xr-x | t/t9003-help-autocorrect.sh | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh index b1c7919c4a..03cd5c5423 100755 --- a/t/t9003-help-autocorrect.sh +++ b/t/t9003-help-autocorrect.sh @@ -37,16 +37,30 @@ test_expect_success 'autocorrect showing candidates' ' grep "^ distimdistim" actual ' -test_expect_success 'autocorrect running commands' ' - git config help.autocorrect -1 && +for immediate in -1 immediate +do + test_expect_success 'autocorrect running commands' ' + git config help.autocorrect $immediate && - git lfg >actual && - echo "a single log entry" >expect && - test_cmp expect actual && + git lfg >actual && + echo "a single log entry" >expect && + test_cmp expect actual && - git distimdist >actual && - echo "distimdistim was called" >expect && - test_cmp expect actual + git distimdist >actual && + echo "distimdistim was called" >expect && + test_cmp expect actual + ' +done + +test_expect_success 'autocorrect can be declined altogether' ' + git config help.autocorrect never && + + test_must_fail git lfg 2>actual && + if test_have_prereq C_LOCALE_OUTPUT + then + grep "is not a git command" actual && + test_line_count = 1 actual + fi ' test_done |