git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stephen Boyd <bebarino@gmail.com>
Cc: git@vger.kernel.org,
	Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Subject: Re: [PATCH] send-email: validate & reconfirm interactive responses
Date: Wed, 05 Sep 2012 20:29:14 -0700	[thread overview]
Message-ID: <7vsjav6d85.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CALaEz9WVCj0gu-CbUJgydik1bC7z7JCcveKTdyxgrTWokXq5JA@mail.gmail.com> (Stephen Boyd's message of "Wed, 5 Sep 2012 12:24:36 -0700")

Stephen Boyd <bebarino@gmail.com> writes:

> On Tue, Aug 14, 2012 at 3:25 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> @@ -745,13 +752,15 @@ sub file_declares_8bit_cte {
>>  if (!defined $sender) {
>>         $sender = $repoauthor || $repocommitter || '';
>>         $sender = ask("Who should the emails appear to be from? [$sender] ",
>> -                     default => $sender);
>> +                     default => $sender,
>> +                     valid_re => qr/\@.*\./, confirm_only => 1);
>
> This is now bugging me if I just hit enter and don't want to specify
> anything for
> these headers (I want the defaults or what's in the files already).
> Can we allow
> the empty string to be valid as well so I don't have to go through
> these prompts?

That indeed was the intention, and if it is not behaving, you found
a bug.

The relevant code in "sub ask" does this:

		...
                $resp = $term->readline($prompt);
                if (!defined $resp) { # EOF
                        print "\n";
                        return defined $default ? $default : undef;
                }
                if ($resp eq '' and defined $default) {
                        return $default;
                }
                if (!defined $valid_re or $resp =~ /$valid_re/) {
                        return $resp;
                }

I am scratching my head wondering why your "just hit enter" does not
trigger the "if response is empty and we have default, just return it"
codepath we can see above.  It shouldn't even trigger the regexp
based validation codepath in the first place.

  reply	other threads:[~2012-09-06  3:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 23:50 send-email and in-reply-to = n Stephen Boyd
2012-08-13 23:53 ` Junio C Hamano
2012-08-14 20:51   ` Martin von Zweigbergk
2012-08-14 22:25     ` [PATCH] send-email: validate & reconfirm interactive responses Junio C Hamano
2012-08-14 22:33       ` Martin von Zweigbergk
2012-08-14 22:57         ` Junio C Hamano
2012-09-05 19:24       ` Stephen Boyd
2012-09-06  3:29         ` Junio C Hamano [this message]
2012-09-06 18:31           ` Stephen Boyd
2012-09-06 20:03             ` Junio C Hamano
2012-09-06 21:21               ` [PATCH] send-email: initial_to and initial_reply_to are both optional Junio C Hamano
2012-09-06 21:49                 ` Stephen Boyd
2012-09-06 21:47               ` [PATCH] send-email: validate & reconfirm interactive responses Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vsjav6d85.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bebarino@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.von.zweigbergk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).