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

Re: [PATCH] Tweak help auto-correct phrasing.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 19, 2016, 22:04 UTC
Message-ID
<xmqqpoknmv7d.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161219170137.5507-1-marcnarc@xiplink.com>
Marc Branchaud <marcnarc@xiplink.com> writes:
Show 25 quoted lines
> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
>
> On 2016-12-18 07:48 PM, Chris Packham wrote:
>>
>> This feature already exists (although it's not interactive). See
>> help.autoCorrect in the git-config man page. "git config
>> help.autoCorrect -1" should to the trick.
>
> Awesome, I was unaware of this feature.  Thanks!
>
> I found the message it prints a bit awkward, so here's a patch to fix it up.
>
> Instead of:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing under the assumption that you meant 'log'
>    in 1.5 seconds automatically...
>
> it's now:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing in 1.5 seconds under the assumption that you meant 'log'.
>
> 		M.
Sounds better.

The "Instead of ... we now show ..." description deserves to be in the log message, not after "---" line.

s/under the assumption/assuming/ would make it even shorter and give the potentially long corrected command name a chance to still fit on the line without wrapping, I would think, though.

Show 33 quoted lines
>
>  help.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/help.c b/help.c
> index 53e2a67e00..55350c0673 100644
> --- a/help.c
> +++ b/help.c
> @@ -381,12 +381,18 @@ const char *help_unknown_cmd(const char *cmd)
>  		clean_cmdnames(&main_cmds);
>  		fprintf_ln(stderr,
>  			   _("WARNING: You called a Git command named '%s', "
> -			     "which does not exist.\n"
> -			     "Continuing under the assumption that you meant '%s'"),
> -			cmd, assumed);
> -		if (autocorrect > 0) {
> -			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
> -				(float)autocorrect/10.0);
> +			     "which does not exist."),
> +			   cmd);
> +		if (autocorrect < 0)
> +			fprintf_ln(stderr,
> +				   _("Continuing under the assumption that "
> +				     "you meant '%s'."),
> +				   assumed);
> +		else {
> +			fprintf_ln(stderr,
> +				   _("Continuing in %0.1f seconds under the "
> +				     "assumption that you meant '%s'."),
> +				   (float)autocorrect/10.0, assumed);
>  			sleep_millisec(autocorrect * 100);
>  		}
>  		return assumed;
Previous: Marc BranchaudNext: Marc Branchaud
Message 7 of 14 in “Suggestion for the "Did you mean this?" feature”
  1. Kaartic SivaraamDec 18, 2016
  2. Stephan BeyerDec 18, 2016
  3. Kaartic SivaraamDec 18, 2016
  4. Alexei LozovskyDec 18, 2016
  5. Chris PackhamDec 19, 2016
  6. Tweak help auto-correct phrasing.Marc Branchaud, Dec 19, 2016
  7. Junio C HamanoDec 19, 2016
  8. [PATCHv2] Tweak help auto-correct phrasing.Marc Branchaud, Dec 20, 2016
  9. Kaartic SivaraamJun 20, 2017
  10. Marc BranchaudJun 20, 2017
  11. [PATCHv2 (resend)] Tweak help auto-correct phrasing.Marc Branchaud, Jun 21, 2017
  12. Junio C HamanoJun 21, 2017
  13. Kaartic SivaraamJun 20, 2017
  14. Kaartic SivaraamDec 19, 2016

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.