]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Merge branch 'mw/send-email'
authorJunio C Hamano <gitster@pobox.com>
Sun, 31 May 2009 23:16:52 +0000 (16:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 31 May 2009 23:16:52 +0000 (16:16 -0700)
* 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

1  2 
Documentation/git-send-email.txt
git-send-email.perl

index f9407702794b0546f21844bafadb32b0c7984bd1,f7e428eb50292e2a186cd903fa4610f446c3890f..7c5ce415c7f27b4fb9b90ba65abf16158d36af82
@@@ -39,6 -39,10 +39,10 @@@ OPTION
  Composing
  ~~~~~~~~~
  
+ --annotate::
+       Review and edit each patch you're about to send. See the
+       CONFIGURATION section for 'sendemail.multiedit'.
  --bcc=<address>::
        Specify a "Bcc:" value for each email. Default is the value of
        'sendemail.bcc'.
@@@ -51,11 -55,6 +55,6 @@@ The --bcc option must be repeated for e
  +
  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::
        Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
        introductory message for the patch series.
@@@ -67,14 -66,13 +66,16 @@@ In-Reply-To headers specified in the me
  and In-Reply-To headers will be used unless they are removed.
  +
  Missing From or In-Reply-To headers will be prompted for.
+ +
+ See the CONFIGURATION section for 'sendemail.multiedit'.
  
  --from=<address>::
 -      Specify the sender of the emails.  This will default to
 -      the value GIT_COMMITTER_IDENT, as returned by "git var -l".
 -      The user will still be prompted to confirm this entry.
 +      Specify the sender of the emails.  If not specified on the command line,
 +      the value of the 'sendemail.from' configuration option is used.  If
 +      neither the command line option nor 'sendemail.from' are set, then the
 +      user will be prompted for the value.  The default for the prompt will be
 +      the value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is not
 +      set, as returned by "git var -l".
  
  --in-reply-to=<identifier>::
        Specify the contents of the first In-Reply-To header.
@@@ -138,7 -136,9 +139,9 @@@ user is prompted for a password while t
  --smtp-server-port=<port>::
        Specifies a port different from the default port (SMTP
        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::
        Legacy alias for '--smtp-encryption ssl'.
@@@ -233,6 -233,12 +236,12 @@@ have been specified, in which case defa
  --dry-run::
        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::
        Make git-send-email less verbose.  One line per email should be
        all that is output.
  Default is the value of 'sendemail.validate'; if this is not set,
  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
  -------------
@@@ -265,7 -265,7 +268,7 @@@ sendemail.aliasesfile:
  
  sendemail.aliasfiletype::
        Format of the file(s) specified in sendemail.aliasesfile. Must be
 -      one of 'mutt', 'mailrc', 'pine', or 'gnus'.
 +      one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.
  
  sendemail.multiedit::
        If true (default), a single editor instance will be spawned to edit
diff --combined git-send-email.perl
index e793935b4f2980aa1e333f7e8424b293b4b59399,04267c58dd81075233a165bba307e0ddee5a7611..3d6a98218a23cdda4a4cf3752c5a0f7030c2bad5
@@@ -210,7 -210,6 +210,7 @@@ my %config_settings = 
      "envelopesender" => \$envelope_sender,
      "multiedit" => \$multiedit,
      "confirm"   => \$confirm,
 +    "from" => \$sender,
  );
  
  # Handle Uncouth Termination
@@@ -410,7 -409,7 +410,7 @@@ my %parse_alias = 
        mailrc => sub { my $fh = shift; while (<$fh>) {
                if (/^alias\s+(\S+)\s+(.*)$/) {
                        # spaces delimit multiple addresses
 -                      $aliases{$1} = [ split(/\s+/, $2) ];
 +                      $aliases{$1} = [ quotewords('\s+', 0, $2) ];
                }}},
        pine => sub { my $fh = shift; my $f='\t[^\t]*';
                for (my $x = ''; defined($x); $x = $_) {
                        $x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next;
                        $aliases{$1} = [ split_addrs($2) ];
                }},
 +      elm => sub  { my $fh = shift;
 +                    while (<$fh>) {
 +                        if (/^(\S+)\s+=\s+[^=]+=\s(\S+)/) {
 +                            my ($alias, $addr) = ($1, $2);
 +                             $aliases{$alias} = [ split_addrs($addr) ];
 +                        }
 +                    } },
 +
        gnus => sub { my $fh = shift; while (<$fh>) {
                if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
                        $aliases{$1} = [ $2 ];
@@@ -538,7 -529,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 -544,6 +553,6 @@@ EO
        }
        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 {
        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 -794,10 +803,10 @@@ sub sanitize_addres
  
  }
  
+ # 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 -866,7 +875,7 @@@ X-Mailer: git-send-email $gitversio
                         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);
                $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);
                        print "Result: OK\n";
                }
        }
+       return 1;
  }
  
  $reply_to = $initial_reply_to;
@@@ -1135,10 -1130,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";