X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-send-email.perl;h=ba39d393843733b46f309deb105c90cabcee2cb1;hb=6211988f77ab20cc8705fb8c9ecb72ba166b80da;hp=4a20310841b69280a21ac4c79d95ce9ce3ea7df4;hpb=284fe4beb6b4835ef6857cd56b34c70c1d12b14d;p=git.git diff --git a/git-send-email.perl b/git-send-email.perl index 4a2031084..ba39d3938 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -83,11 +83,12 @@ sub cleanup_compose_files(); my $compose_filename = ".msg.$$"; # Variables we fill in automatically, or via prompting: -my (@to,@cc,@initial_cc,@bcclist, +my (@to,@cc,@initial_cc,@bcclist,@xh, $initial_reply_to,$initial_subject,@files,$from,$compose,$time); # Behavior modification variables -my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc) = (1, 0, 0, 0); +my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc, + $dry_run) = (1, 0, 0, 0, 0); my $smtp_server; # Example reply to: @@ -116,6 +117,7 @@ my $rc = GetOptions("from=s" => \$from, "quiet" => \$quiet, "suppress-from" => \$suppress_from, "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc, + "dry-run" => \$dry_run, ); # Verify the user input @@ -176,11 +178,10 @@ my $prompting = 0; 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++; } @@ -228,6 +229,9 @@ if (!defined $initial_reply_to && $prompting) { $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 $_) { @@ -409,6 +413,11 @@ sub send_message $gitversion = Git::version(); } + my ($author_name) = ($from =~ /^(.*?)\s+) { if (!$header_done) { - $found_mbox = 1, next if (/^From /); + if (/^From /) { + $input_format = 'mbox'; + next; + } chomp; + if (!defined $input_format && /^[-A-Za-z]+:\s/) { + $input_format = 'mbox'; + } - if ($found_mbox) { + if (defined $input_format && $input_format eq 'mbox') { if (/^Subject:\s+(.*)$/) { $subject = $1; @@ -495,6 +516,9 @@ foreach my $t (@files) { $2, $_) unless $quiet; push @cc, $2; } + elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) { + push @xh, $_; + } } else { # In the traditional @@ -502,6 +526,7 @@ foreach my $t (@files) { # line 1 = cc # line 2 = subject # So let's support that, too. + $input_format = 'lots'; if (@cc == 0) { printf("(non-mbox) Adding cc: %s from line '%s'\n", $_, $_) unless $quiet; @@ -538,7 +563,7 @@ foreach my $t (@files) { send_message(); # set up for the next message - if ($chain_reply_to || length($reply_to) == 0) { + if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) { $reply_to = $message_id; if (length $references > 0) { $references .= " $message_id";