t5505: do not assume the "matching" push is the default
[gitweb.git] / git-send-email.perl
index 5a783ace0588dae9e4fd2666de9ae81ae4d5b1be..94c7f76a156f1eaa4c622db267710f2982cf7826 100755 (executable)
@@ -753,16 +753,11 @@ sub file_declares_8bit_cte {
        }
 }
 
-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;
 if (!@initial_to && !defined $to_cmd) {
        my $to = ask("Who should the emails be sent to (if any)? ",
                     default => "",
@@ -851,9 +846,20 @@ sub extract_valid_address_or_die {
 
 sub validate_address {
        my $address = shift;
-       if (!extract_valid_address($address)) {
-               print STDERR "W: unable to extract a valid address from: $address\n";
-               return undef;
+       while (!extract_valid_address($address)) {
+               print STDERR "error: unable to extract a valid address from: $address\n";
+               $_ = ask("What to do with this address? ([q]uit|[d]rop|[e]dit): ",
+                       valid_re => qr/^(?:quit|q|drop|d|edit|e)/i,
+                       default => 'q');
+               if (/^d/i) {
+                       return undef;
+               } elsif (/^q/i) {
+                       cleanup_compose_files();
+                       exit(0);
+               }
+               $address = ask("Who should the email be sent to (if any)? ",
+                       default => "",
+                       valid_re => qr/\@.*\./, confirm_only => 1);
        }
        return $address;
 }