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

Re: [PATCH v2] help.c: help.autocorrect=prompt waits for user action

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 14, 2021, 18:20 UTC
Message-ID
<xmqqmtpjubuv.fsf@gitster.g>
In-Reply-To
<pull.1012.v2.git.1628917872724.gitgitgadget@gmail.com>
"Azeem Bande-Ali via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 7 quoted lines
> @@ -618,7 +628,17 @@ const char *help_unknown_cmd(const char *cmd)
>  				   _("Continuing under the assumption that "
>  				     "you meant '%s'."),
>  				   assumed);
> -		else {
> +		else if (autocorrect == AUTOCORRECT_PROMPT) {
> +			char* answer;

Some people seem to make an asterisk stick to types like this, but in our codebase written in C, an asterisk sticks to the identifier that it makes into a pointer, i.e.

			char *answer;

This is because doing so differently would confuse novices with constructs like this:

			int* a, b;
where only 'a' is a pointer, and 'b' is not.
> +			struct strbuf msg = STRBUF_INIT;
> +			strbuf_addf(&msg, _("Run '%s' instead? (y/N)"),
> +				    assumed);
I think these should be kept on a single line for readability, i.e.
			strbuf_addf(&msg, _("Run '%s' instead? (y/N)"), assumed);
as I see a fairly long line after this block already.
	fprintf_ln(stderr, _("git: '%s' is not a git command. See 'git --help'."), cmd);

Other than these cosmetic bits, this round looks good to me, including the documentation update.

Thanks.
Previous: Bagas SanjayaNext: Azeem Bande-Ali
Message 8 of 12 in “help.c: help.autocorrect=prompt waits for user action”
  1. help.c: help.autocorrect=prompt waits for user actionAzeem Bande-Ali via GitGitGadget, Aug 11, 2021
  2. Bagas SanjayaAug 12, 2021
  3. Azeem Bande-AliAug 14, 2021
  4. Junio C HamanoAug 12, 2021
  5. Azeem Bande-AliAug 14, 2021
  6. help.c: help.autocorrect=prompt waits for user actionAzeem Bande-Ali via GitGitGadget, Aug 14, 2021
  7. Bagas SanjayaAug 14, 2021
  8. Junio C HamanoAug 14, 2021
  9. Azeem Bande-AliAug 14, 2021
  10. Johannes SchindelinAug 16, 2021
  11. help.c: help.autocorrect=prompt waits for user actionAzeem Bande-Ali via GitGitGadget, Aug 15, 2021
  12. Junio C HamanoSep 8, 2021

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.