diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-05-31 16:16:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-31 16:16:52 -0700 |
commit | 06676213d206b7e1eb8f2eea16cca7239a5e0edc (patch) | |
tree | 6313cc7cf60cdc9c10d001b9f54aadfaf498c562 /git-send-email.perl | |
parent | 1136e2c6426f736fd4fde6d4cf901e8b192ab30b (diff) | |
parent | bec99cfc679b8c754ddd03feeb691b4c054ccc6a (diff) | |
download | git-06676213d206b7e1eb8f2eea16cca7239a5e0edc.tar.gz |
Merge branch 'mw/send-email'
* mw/send-email:
send-email: Remove superfluous `my $editor = ...'
send-email: 'References:' should only reference what is sent
send-email: Handle "GIT:" rather than "GIT: " during --compose
Docs: send-email: --smtp-server-port can take symbolic ports
Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit
Docs: send-email: Put options back into alphabetical order
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | git-send-email.perl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index e793935b4f..3d6a98218a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -538,7 +538,7 @@ if ($compose) { print C <<EOT; From $tpl_sender # This line is ignored. -GIT: Lines beginning in "GIT: " will be removed. +GIT: Lines beginning in "GIT:" will be removed. GIT: Consider including an overall diffstat or table of contents GIT: for the patch you are writing. GIT: @@ -553,8 +553,6 @@ EOT } close(C); - my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi"; - if ($annotate) { do_edit($compose_filename, @files); } else { @@ -571,7 +569,7 @@ EOT my $in_body = 0; my $summary_empty = 1; while(<C>) { - next if m/^GIT: /; + next if m/^GIT:/; if ($in_body) { $summary_empty = 0 unless (/^\n$/); } elsif (/^\n$/) { @@ -805,6 +803,10 @@ sub sanitize_address } +# Returns 1 if the message was sent, and 0 otherwise. +# In actuality, the whole program dies when a there +# is an error sending a message. + sub send_message { my @recipients = unique_email_list(@to); @@ -873,7 +875,7 @@ X-Mailer: git-send-email $gitversion default => $ask_default); die "Send this email reply required" unless defined $_; if (/^n/i) { - return; + return 0; } elsif (/^q/i) { cleanup_compose_files(); exit(0); @@ -954,7 +956,7 @@ X-Mailer: git-send-email $gitversion $smtp->data or die $smtp->message; $smtp->datasend("$header\n$message") or die $smtp->message; $smtp->dataend() or die $smtp->message; - $smtp->ok or die "Failed to send $subject\n".$smtp->message; + $smtp->code =~ /250|200/ or die "Failed to send $subject\n".$smtp->message; } if ($quiet) { printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject); @@ -975,6 +977,8 @@ X-Mailer: git-send-email $gitversion print "Result: OK\n"; } } + + return 1; } $reply_to = $initial_reply_to; @@ -1135,10 +1139,10 @@ foreach my $t (@files) { @cc = (@initial_cc, @cc); - send_message(); + my $message_was_sent = send_message(); # set up for the next message - if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) { + if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) { $reply_to = $message_id; if (length $references > 0) { $references .= "\n $message_id"; |