git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] help.c: expand options for help.autocorrect

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 18, 2020, 18:15 UTC
Message-ID
<xmqqwnyi1qgs.fsf@gitster.c.googlers.com>
In-Reply-To
<xmqq1rgq35my.fsf@gitster.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 19 quoted lines
> Drew DeVault <sir@cmpwn.com> writes:
>
>> Some users would prefer to never suggest corrections at all.
>
> Here is how I would have phrased it.
>
> Key points:
>
>  - The log message starts with the description of the current state
>    of the system and introduces the problem the patch tries to
>    solve.
>
>  - Then gives orders to the codebase to "be like so"
>
>  - The addition of "never" is the primary change to solve the stated
>    problem.  "immediate" is not the essential part but is merely
>    adding a synonym while we are in the vicinity.
>
> Thanks.

Also, I think we would want _some_ test, as the base form of help.autocorrect is already tested. Perhaps something like this.

 t/t9003-help-autocorrect.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git c/t/t9003-help-autocorrect.sh w/t/t9003-help-autocorrect.sh
index b1c7919c4a..8f1035c3c2 100755
--- c/t/t9003-help-autocorrect.sh
+++ w/t/t9003-help-autocorrect.sh
@@ -49,4 +49,17 @@ test_expect_success 'autocorrect running commands' '
 	test_cmp expect actual
 '
 
+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
+		: cannot test with poisoned i18n
+	else
+		grep "is not a git command" actual &&
+		test_line_count = 1 actual
+	fi
+'
+
 test_done
Previous: Junio C HamanoNext: SZEDER Gábor
Message 3 of 5 in “help.c: expand options for help.autocorrect”
  1. help.c: expand options for help.autocorrectDrew DeVault, Nov 18, 2020
  2. Junio C HamanoNov 18, 2020
  3. Junio C HamanoNov 18, 2020
  4. SZEDER GáborNov 25, 2020
  5. Junio C HamanoNov 25, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.