Re: [PATCHv2 8/8] send-email: do not prompt for explicit repo ident

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

 



On Thu, Nov 15, 2012 at 1:36 AM, Jeff King <peff@xxxxxxxx> wrote:

> diff --git a/git-send-email.perl b/git-send-email.perl
> index 5a7c29d..0c49b32 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -436,9 +436,8 @@ if (0) {
>         }
>  }
>
> -my ($repoauthor, $repocommitter);
> -($repoauthor) = Git::ident_person(@repo, 'author');
> -($repocommitter) = Git::ident_person(@repo, 'committer');
> +my ($repoauthor, $author_explicit) = Git::ident_person(@repo, 'author');
> +my ($repocommitter, $committer_explicit) = Git::ident_person(@repo, 'committer');
>
>  # Verify the user input
>
> @@ -755,12 +754,17 @@ if (!$force) {
>
>  my $prompting = 0;
>  if (!defined $sender) {
> -       $sender = $repoauthor || $repocommitter || '';
> -       $sender = ask("Who should the emails appear to be from? [$sender] ",
> -                     default => $sender,
> -                     valid_re => qr/\@.*\./, confirm_only => 1);
> -       print "Emails will be sent from: ", $sender, "\n";
> -       $prompting++;
> +       ($sender, my $explicit) =
> +               defined $repoauthor ? ($repoauthor, $author_explicit) :
> +               defined $repocommitter ? ($repocommitter, $committer_explicit) :
> +               ('', 0);
> +       if (!$explicit) {
> +               $sender = ask("Who should the emails appear to be from? [$sender] ",
> +                             default => $sender,
> +                             valid_re => qr/\@.*\./, confirm_only => 1);
> +               print "Emails will be sent from: ", $sender, "\n";
> +               $prompting++;
> +       }
>  }
>
>  if (!@initial_to && !defined $to_cmd) {

I don't think there's any need for all that, this does the trick:

diff --git a/git-send-email.perl b/git-send-email.perl
index aea66a0..503e551 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -748,16 +748,11 @@ if (!$force) {
        }
 }

-my $prompting = 0;
 if (!defined $sender) {
        $sender = $repoauthor || $repocommitter || '';
-       $sender = ask("Who should the emails appear to be from? [$sender] ",
-                     default => $sender,
-                     valid_re => qr/\@.*\./, confirm_only => 1);
-       print "Emails will be sent from: ", $sender, "\n";
-       $prompting++;
 }

+my $prompting = 0;

This passes all the current tests and the ones you added.

Which kind of user will get the prompt with your patch, that would
miss it with mine?

Cheers.

-- 
Felipe Contreras
--
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]