Support --amend on initial commit in status output
[gitweb.git] / git-send-email.perl
index b17d2619875112215465c7399fa30e592ed71b01..ba39d393843733b46f309deb105c90cabcee2cb1 100755 (executable)
@@ -178,11 +178,10 @@ sub format_2822_time {
 if (!defined $from) {
        $from = $author || $committer;
        do {
-               $_ = $term->readline("Who should the emails appear to be from? ",
-                       $from);
+               $_ = $term->readline("Who should the emails appear to be from? [$from] ");
        } while (!defined $_);
 
-       $from = $_;
+       $from = $_ if ($_);
        print "Emails will be sent from: ", $from, "\n";
        $prompting++;
 }
@@ -230,6 +229,9 @@ sub expand_aliases {
        $initial_reply_to =~ s/(^\s+|\s+$)//g;
 }
 
+if (!$smtp_server) {
+       $smtp_server = $repo->config('sendemail.smtpserver');
+}
 if (!$smtp_server) {
        foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
                if (-x $_) {
@@ -412,7 +414,7 @@ sub send_message
        }
 
        my ($author_name) = ($from =~ /^(.*?)\s+</);
-       if ($author_name =~ /\./ && $author_name !~ /^".*"$/) {
+       if ($author_name && $author_name =~ /\./ && $author_name !~ /^".*"$/) {
                my ($name, $addr) = ($from =~ /^(.*?)(\s+<.*)/);
                $from = "\"$name\"$addr";
        }
@@ -514,7 +516,7 @@ sub send_message
                                                $2, $_) unless $quiet;
                                        push @cc, $2;
                                }
-                               elsif (/^[-A-Za-z]+:\s+\S/) {
+                               elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) {
                                        push @xh, $_;
                                }