Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-12-14 21:21:36 +0300
committerJunio C Hamano <gitster@pobox.com>2020-12-14 21:21:36 +0300
commit78abcff222d2d9cb05776bac39f7dc6a84b8f809 (patch)
tree622cf8ba301d0f32c8e56d669abfc0c76826be07 /t
parent3cf59784d42c4152a0b3de7bb7a75d0071e5f878 (diff)
parent644bb953ce3251f2868ece6b767949828fa32e44 (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-xt/t9003-help-autocorrect.sh30
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