Re: [PATCH] send-email: validate & reconfirm interactive responses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin von Zweigbergk <martin.von.zweigbergk@xxxxxxxxx> writes:

> On Tue, Aug 14, 2012 at 3:25 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> People answer 'y' to "Who should the emails appear to be from?"  and
>> 'n' to "Message-ID to be used as In-Reply-To for the first email?"
>> for some unknown reason.
>
> Yeah, I know :-(. I did feel stupid already. Thanks for improving.

Actually, it is a very understandable mistake and I do not think it
is a user stupidity.  It is a UI bug in the prompter that gives:

  Who should the emails appear to be from? [Junio C Hamano <gitster@xxxxxxxxx>]

and does *not* tell the user that the way to accept the default is
to just press RETURN.  It makes it look as if it is asking "Is it OK
to use this?", and it is a natural response to say "Yes" to the
prompt.

We would want to do something like the following pseudo-patch, I
think, but I do not know what is the best way to show both $prompt
and the "press return" suggestion to the user, so I am not going to
do this myself.

A tested patch to improve this is very much welcomed.

Thanks.

diff --git a/git-send-email.perl b/git-send-email.perl
index 607137b..2ec0ce8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -688,6 +688,9 @@ sub ask {
 		unless defined $term->IN and defined fileno($term->IN) and
 		       defined $term->OUT and defined fileno($term->OUT);
 	while ($i++ < 10) {
+		if (defined $default) {
+			SAY "(press RETURN to accept the default)";
+		}
 		$resp = $term->readline($prompt);
 		if (!defined $resp) { # EOF
 			print "\n";



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]