help: show the suggested command when help.autocorrect is false

Make the handling of false boolean values for help.autocorrect
consistent with the handling of value 0 by showing the suggested
commands but not running them.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Aguilar
2025-02-01 13:33:18 -08:00
committed by Junio C Hamano
parent a0fc18f042
commit e21bf2c431
3 changed files with 16 additions and 11 deletions

View File

@ -28,15 +28,18 @@ test_expect_success 'setup' '
test_cmp expect actual
'
test_expect_success 'autocorrect showing candidates' '
git config help.autocorrect 0 &&
for show in false no off 0
do
test_expect_success 'autocorrect showing candidates' '
git config help.autocorrect $show &&
test_must_fail git lfg 2>actual &&
grep "^ lgf" actual &&
test_must_fail git lfg 2>actual &&
grep "^ lgf" actual &&
test_must_fail git distimdist 2>actual &&
grep "^ distimdistim" actual
'
test_must_fail git distimdist 2>actual &&
grep "^ distimdistim" actual
'
done
for immediate in -1 immediate
do