Merge branch 'mg/maint-send-email-lazy-editor' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 10 Apr 2010 05:23:04 +0000 (22:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Apr 2010 05:23:04 +0000 (22:23 -0700)
* mg/maint-send-email-lazy-editor:
send-email: lazily assign editor variable

1  2 
git-send-email.perl
diff --combined git-send-email.perl
index e05455f74c7e23c28cae41b68fa80df87c633ce9,0d53b653004bbb8e986274d658e8ee5b8ee3d971..1b99f40390ab62102cfb0aeaba5303c9c6904930
@@@ -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,9 -162,12 +162,12 @@@ my $compose_filename
  
  # Handle interactive edition of files.
  my $multiedit;
- my $editor = Git::command_oneline('var', 'GIT_EDITOR');
+ my $editor;
  
  sub do_edit {
+       if (!defined($editor)) {
+               $editor = Git::command_oneline('var', 'GIT_EDITOR');
+       }
        if (defined($multiedit) && !$multiedit) {
                map {
                        system('sh', '-c', $editor.' "$@"', $editor, $_);
@@@ -187,11 -190,9 +190,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, 1],
 +    "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 -217,6 +219,19 @@@ my %config_settings = 
      "from" => \$sender,
  );
  
 +# 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
 +                  "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 {
  
@@@ -877,9 -865,7 +880,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);
@@@ -1174,7 -1160,7 +1177,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";