Re: [PATCH] help: add space after autocorrect prompt
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 15, 2021, 22:32 UTC
- Message-ID
- <xmqqh7b933ej.fsf@gitster.g>
- In-Reply-To
- <pull.1166.git.git.1639604468498.gitgitgadget@gmail.com>
"kashav madan via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> From: Kashav Madan <kshvmdn@gmail.com> > > Signed-off-by: Kashav Madan <kshvmdn@gmail.com> > --- > help: add space after autocorrect prompt
The patch looks OK-ish, but let's make sure. We will find what we should write in the log message while doing so.
If you look at the output from
$ git grep -C2 git_prompt \*.c
you'll notice that existing message given to git_prompt look like these:
yesno = git_prompt(_("Are you sure [Y/n]? "), PROMPT_ECHO); yesno = git_prompt(_("Do you want me to do it for you "
"[Y/n]? "), PROMPT_ECHO); strbuf_addf(&msg, _("Run '%s' instead? (y/N)"), assumed);
answer = git_prompt(msg.buf, PROMPT_ECHO);The last one is what you are touching in this patch.
There is another one in credential.c that asks not just a single yes/no answer, so it is justifiably different from all the others, but the one you noticed is different from what we see above in three points:
- It does not leave a SP before where the end-user input goes; - It append (y/N) _after_ question mark; - It encloses the choices in (), not [].
You are only addressing the first inconsistency, leaving the other two still there.
So, perhaps you would want to explain the change this way
Subject: [PATCH] help: update auto-correction prompt to look more like others
There are three callsite of git_prompt() helper function to ask
a "yes/no" question to the end user, but one of them in help.c
that asks if the suggested auto-correction is OK, which is given
when the user makes a possible typo in a Git subcommand name, is
formatted differently from others. Update the format string to
make the prompt string look more consistent.And you'd want to update the string more like so:
> - strbuf_addf(&msg, _("Run '%s' instead? (y/N)"), assumed);
> + strbuf_addf(&msg, _("Run '%s' instead [y/N]? "), assumed);to fix all three points, not just one.
Thanks.