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
This commit is contained in:
Junio C Hamano
2009-05-31 16:16:52 -07:00
2 changed files with 27 additions and 20 deletions

View File

@ -39,6 +39,10 @@ OPTIONS
Composing Composing
~~~~~~~~~ ~~~~~~~~~
--annotate::
Review and edit each patch you're about to send. See the
CONFIGURATION section for 'sendemail.multiedit'.
--bcc=<address>:: --bcc=<address>::
Specify a "Bcc:" value for each email. Default is the value of Specify a "Bcc:" value for each email. Default is the value of
'sendemail.bcc'. 'sendemail.bcc'.
@ -51,11 +55,6 @@ The --bcc option must be repeated for each user you want on the bcc list.
+ +
The --cc option must be repeated for each user you want on the cc list. The --cc option must be repeated for each user you want on the cc list.
--annotate::
Review each patch you're about to send in an editor. The setting
'sendemail.multiedit' defines if this will spawn one editor per patch
or one for all of them at once.
--compose:: --compose::
Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
introductory message for the patch series. introductory message for the patch series.
@ -67,6 +66,8 @@ In-Reply-To headers specified in the message. If the body of the message
and In-Reply-To headers will be used unless they are removed. and In-Reply-To headers will be used unless they are removed.
+ +
Missing From or In-Reply-To headers will be prompted for. Missing From or In-Reply-To headers will be prompted for.
+
See the CONFIGURATION section for 'sendemail.multiedit'.
--from=<address>:: --from=<address>::
Specify the sender of the emails. If not specified on the command line, Specify the sender of the emails. If not specified on the command line,
@ -138,7 +139,9 @@ user is prompted for a password while the input is masked for privacy.
--smtp-server-port=<port>:: --smtp-server-port=<port>::
Specifies a port different from the default port (SMTP Specifies a port different from the default port (SMTP
servers typically listen to smtp port 25 and ssmtp port servers typically listen to smtp port 25 and ssmtp port
465). This can be set with 'sendemail.smtpserverport'. 465); symbolic port names (e.g. "submission" instead of 465)
are also accepted. The port can also be set with the
'sendemail.smtpserverport' configuration variable.
--smtp-ssl:: --smtp-ssl::
Legacy alias for '--smtp-encryption ssl'. Legacy alias for '--smtp-encryption ssl'.
@ -233,6 +236,12 @@ have been specified, in which case default to 'compose'.
--dry-run:: --dry-run::
Do everything except actually send the emails. Do everything except actually send the emails.
--[no-]format-patch::
When an argument may be understood either as a reference or as a file name,
choose to understand it as a format-patch argument ('--format-patch')
or as a file name ('--no-format-patch'). By default, when such a conflict
occurs, git send-email will fail.
--quiet:: --quiet::
Make git-send-email less verbose. One line per email should be Make git-send-email less verbose. One line per email should be
all that is output. all that is output.
@ -249,12 +258,6 @@ have been specified, in which case default to 'compose'.
Default is the value of 'sendemail.validate'; if this is not set, Default is the value of 'sendemail.validate'; if this is not set,
default to '--validate'. default to '--validate'.
--[no-]format-patch::
When an argument may be understood either as a reference or as a file name,
choose to understand it as a format-patch argument ('--format-patch')
or as a file name ('--no-format-patch'). By default, when such a conflict
occurs, git send-email will fail.
CONFIGURATION CONFIGURATION
------------- -------------

View File

@ -553,8 +553,6 @@ EOT
} }
close(C); close(C);
my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
if ($annotate) { if ($annotate) {
do_edit($compose_filename, @files); do_edit($compose_filename, @files);
} else { } else {
@ -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 sub send_message
{ {
my @recipients = unique_email_list(@to); my @recipients = unique_email_list(@to);
@ -873,7 +875,7 @@ X-Mailer: git-send-email $gitversion
default => $ask_default); default => $ask_default);
die "Send this email reply required" unless defined $_; die "Send this email reply required" unless defined $_;
if (/^n/i) { if (/^n/i) {
return; return 0;
} elsif (/^q/i) { } elsif (/^q/i) {
cleanup_compose_files(); cleanup_compose_files();
exit(0); exit(0);
@ -954,7 +956,7 @@ X-Mailer: git-send-email $gitversion
$smtp->data or die $smtp->message; $smtp->data or die $smtp->message;
$smtp->datasend("$header\n$message") or die $smtp->message; $smtp->datasend("$header\n$message") or die $smtp->message;
$smtp->dataend() 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) { if ($quiet) {
printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject); printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
@ -975,6 +977,8 @@ X-Mailer: git-send-email $gitversion
print "Result: OK\n"; print "Result: OK\n";
} }
} }
return 1;
} }
$reply_to = $initial_reply_to; $reply_to = $initial_reply_to;
@ -1135,10 +1139,10 @@ foreach my $t (@files) {
@cc = (@initial_cc, @cc); @cc = (@initial_cc, @cc);
send_message(); my $message_was_sent = send_message();
# set up for the next 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; $reply_to = $message_id;
if (length $references > 0) { if (length $references > 0) {
$references .= "\n $message_id"; $references .= "\n $message_id";