Merge branch 'jc/1.7.0-send-email-no-thread-default'
authorJunio C Hamano <gitster@pobox.com>
Sat, 26 Dec 2009 22:03:17 +0000 (14:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 26 Dec 2009 22:03:17 +0000 (14:03 -0800)
* jc/1.7.0-send-email-no-thread-default:
send-email: make --no-chain-reply-to the default

Conflicts:
git-send-email.perl

1  2 
Documentation/git-send-email.txt
git-send-email.perl
index 8c482f40b98f81460da7230a8656a9a4a97d77df,626c2dccc175770931058863e75fd989683c5421..ced35b2f532dde3580f162a0c23b642002a0e508
@@@ -60,8 -60,8 +60,8 @@@ The --bcc option must be repeated for e
  The --cc option must be repeated for each user you want on the cc list.
  
  --compose::
 -      Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
 -      introductory message for the patch series.
 +      Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
 +      to edit an introductory message for the patch series.
  +
  When '--compose' is used, git send-email will use the From, Subject, and
  In-Reply-To headers specified in the message. If the body of the message
@@@ -84,7 -84,7 +84,7 @@@ See the CONFIGURATION section for 'send
  --in-reply-to=<identifier>::
        Specify the contents of the first In-Reply-To header.
        Subsequent emails will refer to the previous email
-       instead of this if --chain-reply-to is set (the default)
+       instead of this if --chain-reply-to is set.
        Only necessary if --compose is also set.  If --compose
        is not set, this will be prompted for.
  
@@@ -108,10 -108,9 +108,10 @@@ Sendin
  --envelope-sender=<address>::
        Specify the envelope sender used to send the emails.
        This is useful if your default address is not the address that is
 -      subscribed to a list. If you use the sendmail binary, you must have
 -      suitable privileges for the -f parameter. Default is the value of
 -      the 'sendemail.envelopesender' configuration variable; if that is
 +      subscribed to a list. In order to use the 'From' address, set the
 +      value to "auto". If you use the sendmail binary, you must have
 +      suitable privileges for the -f parameter.  Default is the value of the
 +      'sendemail.envelopesender' configuration variable; if that is
        unspecified, choosing the envelope sender is left to your MTA.
  
  --smtp-encryption=<encryption>::
@@@ -172,8 -171,8 +172,8 @@@ Automatin
        email sent.  If disabled with "--no-chain-reply-to", all emails after
        the first will be sent as replies to the first email sent.  When using
        this, it is recommended that the first file given be an overview of the
-       entire patch series. Default is the value of the 'sendemail.chainreplyto'
-       configuration value; if that is unspecified, default to --chain-reply-to.
+       entire patch series. Disabled by default, but the 'sendemail.chainreplyto'
+       configuration variable can be used to enable it.
  
  --identity=<identity>::
        A configuration identity. When given, causes values in the
diff --combined git-send-email.perl
index 319b5356713b02a48508ee9af2d14781d8760e94,c1d093033dfda7f4dfda9ab4d4e4739c94b1af55..e05455f74c7e23c28cae41b68fa80df87c633ce9
@@@ -71,7 -71,7 +71,7 @@@ git send-email [options] <file | direct
      --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.
      --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.
      --[no-]suppress-from           * Send to self. Default off.
-     --[no-]chain-reply-to          * Chain In-Reply-To: fields. Default on.
+     --[no-]chain-reply-to          * Chain In-Reply-To: fields. Default off.
      --[no-]thread                  * Use In-Reply-To: field. Default on.
  
    Administering:
@@@ -162,8 -162,7 +162,8 @@@ my $compose_filename
  
  # Handle interactive edition of files.
  my $multiedit;
 -my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
 +my $editor = Git::command_oneline('var', 'GIT_EDITOR');
 +
  sub do_edit {
        if (defined($multiedit) && !$multiedit) {
                map {
@@@ -187,11 -186,9 +187,11 @@@ my ($identity, $aliasfiletype, @alias_f
  my ($validate, $confirm);
  my (@suppress_cc);
  
 +my $not_set_by_user = "true but not set by the user";
 +
  my %config_bool_settings = (
      "thread" => [\$thread, 1],
 -    "chainreplyto" => [\$chain_reply_to, undef],
 +    "chainreplyto" => [\$chain_reply_to, $not_set_by_user],
      "suppressfrom" => [\$suppress_from, undef],
      "signedoffbycc" => [\$signed_off_by_cc, undef],
      "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
@@@ -216,19 -213,6 +216,19 @@@ my %config_settings = 
      "from" => \$sender,
  );
  
-                   "In git 1.7.0, the default will be changed to --no-chain-reply-to\n" .
 +# Help users prepare for 1.7.0
 +sub chain_reply_to {
 +      if (defined $chain_reply_to &&
 +          $chain_reply_to eq $not_set_by_user) {
 +              print STDERR
-               $chain_reply_to = 1;
++                  "In git 1.7.0, the default has changed to --no-chain-reply-to\n" .
 +                  "Set sendemail.chainreplyto configuration variable to true if\n" .
 +                  "you want to keep --chain-reply-to as your default.\n";
++              $chain_reply_to = 0;
 +      }
 +      return $chain_reply_to;
 +}
 +
  # Handle Uncouth Termination
  sub signal_handler {
  
@@@ -417,7 -401,7 +417,7 @@@ my %aliases
  my %parse_alias = (
        # multiline formats can be supported in the future
        mutt => sub { my $fh = shift; while (<$fh>) {
 -              if (/^\s*alias\s+(\S+)\s+(.*)$/) {
 +              if (/^\s*alias\s+(?:-group\s+\S+\s+)*(\S+)\s+(.*)$/) {
                        my ($alias, $addr) = ($1, $2);
                        $addr =~ s/#.*$//; # mutt allows # comments
                         # commas delimit multiple addresses
@@@ -851,7 -835,7 +851,7 @@@ sub send_messag
            $gitversion = Git::version();
        }
  
 -      my $cc = join(", ", unique_email_list(@cc));
 +      my $cc = join(",\n\t", unique_email_list(@cc));
        my $ccline = "";
        if ($cc ne '') {
                $ccline = "\nCc: $cc";
@@@ -877,9 -861,7 +877,9 @@@ X-Mailer: git-send-email $gitversio
  
        my @sendmail_parameters = ('-i', @recipients);
        my $raw_from = $sanitized_sender;
 -      $raw_from = $envelope_sender if (defined $envelope_sender);
 +      if (defined $envelope_sender && $envelope_sender ne "auto") {
 +              $raw_from = $envelope_sender;
 +      }
        $raw_from = extract_valid_address($raw_from);
        unshift (@sendmail_parameters,
                        '-f', $raw_from) if(defined $envelope_sender);
                        $smtp ||= Net::SMTP->new((defined $smtp_server_port)
                                                 ? "$smtp_server:$smtp_server_port"
                                                 : $smtp_server);
 -                      if ($smtp_encryption eq 'tls') {
 +                      if ($smtp_encryption eq 'tls' && $smtp) {
                                require Net::SMTP::SSL;
                                $smtp->command('STARTTLS');
                                $smtp->response();
                if ($smtp_server !~ m#^/#) {
                        print "Server: $smtp_server\n";
                        print "MAIL FROM:<$raw_from>\n";
 -                      print "RCPT TO:".join(',',(map { "<$_>" } @recipients))."\n";
 +                      foreach my $entry (@recipients) {
 +                          print "RCPT TO:<$entry>\n";
 +                      }
                } else {
                        print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
                }
@@@ -1174,7 -1154,7 +1174,7 @@@ foreach my $t (@files) 
  
        # set up for the next message
        if ($thread && $message_was_sent &&
 -              ($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {
 +              (chain_reply_to() || !defined $reply_to || length($reply_to) == 0)) {
                $reply_to = $message_id;
                if (length $references > 0) {
                        $references .= "\n $message_id";