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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 6, 2012, 20:03 UTC
Message-ID
<7vipbq3omb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALaEz9W_RR70KEzxk7GxjOu1_yv4UudckcsKAP2C_39Nc2yLbw@mail.gmail.com>
Stephen Boyd <bebarino@gmail.com> writes:
Show 6 quoted lines
> It works fine for "Who should the emails appear to be from?" but
> beyond that we have "Who should the emails be sent to?" and
> "Message-ID to be used as In-Reply-To for the first email?" which I
> typically just hit enter to. It seems that they have no "default"
> argument so that second if fails. I suppose we can add a default => ""
> to these two asks?

For $initial_reply_to, I think "empty" means "I do not want to make this message reply to anything", so I think it is OK to either give a default "", or extendign valid_re to also catch an empty string. In either case, the prompt message may want to clarify what happens when you give an empty input (e.g. "leave this empty to start a new thread", or something).

If you let $to to go empty with the first hunk of your patch, where does the mail eventually go? Does anybody later in the code decide to add some recipient? If there is a reason why an empty input is a valid here, I think there is a stronger need (that is, stronger than the above ase for $initial_reply_to) to explain when the user wants to leave this empty.

Show 22 quoted lines
> ----8<-----
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 607137b..13d813e 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -760,6 +760,7 @@ if (!defined $sender) {
>
>  if (!@initial_to && !defined $to_cmd) {
>         my $to = ask("Who should the emails be sent to? ",
> +                    default => "",
>                      valid_re => qr/\@.*\./, confirm_only => 1);
>         push @initial_to, parse_address_line($to) if defined $to; #
> sanitized/validated later
>         $prompting++;
> @@ -787,6 +788,7 @@ sub expand_one_alias {
>  if ($thread && !defined $initial_reply_to && $prompting) {
>         $initial_reply_to = ask(
>                 "Message-ID to be used as In-Reply-To for the first email? ",
> +               default => "",
>                 valid_re => qr/\@.*\./, confirm_only => 1);
>  }
>  if (defined $initial_reply_to) {
Previous: Stephen BoydNext: Junio C Hamano
Message 10 of 13 in “send-email and in-reply-to = n”
  1. Stephen BoydAug 13, 2012
  2. Junio C HamanoAug 13, 2012
  3. Martin von ZweigbergkAug 14, 2012
  4. send-email: validate & reconfirm interactive responsesJunio C Hamano, Aug 14, 2012
  5. Martin von ZweigbergkAug 14, 2012
  6. Junio C HamanoAug 14, 2012
  7. Stephen BoydSep 5, 2012
  8. Junio C HamanoSep 6, 2012
  9. Stephen BoydSep 6, 2012
  10. Junio C HamanoSep 6, 2012
  11. send-email: initial_to and initial_reply_to are both optionalJunio C Hamano, Sep 6, 2012
  12. Stephen BoydSep 6, 2012
  13. Stephen BoydSep 6, 2012

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.