]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-send-email.perl
user-manual: remove some git-foo usage
[git.git] / git-send-email.perl
index d790660bcf7bdc68a8edee6a2826447da931a9cc..172b53c2d5b8ccad6a1bee592bccbe27d8f3127c 100755 (executable)
@@ -608,7 +608,7 @@ EOT
 
 sub ask {
        my ($prompt, %arg) = @_;
-       my $valid_re = $arg{valid_re} || ""; # "" matches anything
+       my $valid_re = $arg{valid_re};
        my $default = $arg{default};
        my $resp;
        my $i = 0;
@@ -624,7 +624,7 @@ sub ask {
                if ($resp eq '' and defined $default) {
                        return $default;
                }
-               if ($resp =~ /$valid_re/) {
+               if (!defined $valid_re or $resp =~ /$valid_re/) {
                        return $resp;
                }
        }
@@ -687,7 +687,7 @@ if ($compose && $compose > 0) {
 
 # Variables we set as part of the loop over files
 our ($message_id, %mail, $subject, $reply_to, $references, $message,
-       $needs_confirm, $message_num);
+       $needs_confirm, $message_num, $ask_default);
 
 sub extract_valid_address {
        my $address = shift;
@@ -776,12 +776,13 @@ sub sanitize_address
        }
 
        # if recipient_name is already quoted, do nothing
-       if ($recipient_name =~ /^(".*"|=\?utf-8\?q\?.*\?=)$/) {
+       if ($recipient_name =~ /^("[[:ascii:]]*"|=\?utf-8\?q\?.*\?=)$/) {
                return $recipient;
        }
 
        # rfc2047 is needed if a non-ascii char is included
        if ($recipient_name =~ /[^[:ascii:]]/) {
+               $recipient_name =~ s/^"(.*)"$/$1/;
                $recipient_name = quote_rfc2047($recipient_name);
        }
 
@@ -845,7 +846,6 @@ X-Mailer: git-send-email $gitversion
 
        if ($needs_confirm && !$dry_run) {
                print "\n$header\n";
-               my $ask_default;
                if ($needs_confirm eq "inform") {
                        $confirm_unconfigured = 0; # squelch this message for the rest of this run
                        $ask_default = "y"; # assume yes on EOF since user hasn't explicitly asked for confirmation