Merge branch 'mh/fix-send-email-threaded'

* mh/fix-send-email-threaded:
  send-email: fix a typo in a comment
  send-email: fix threaded mails without chain-reply-to
  add a test for git-send-email for threaded mails without chain-reply-to
  doc/send-email: clarify the behavior of --in-reply-to with --no-thread
  send-email: fix non-threaded mails
  add a test for git-send-email for non-threaded mails
This commit is contained in:
Junio C Hamano 2009-06-13 12:55:50 -07:00
commit 08ba24898a
3 changed files with 27 additions and 4 deletions

View File

@ -165,7 +165,7 @@ Automating
Output of this command must be single email address per line. Output of this command must be single email address per line.
Default is the value of 'sendemail.cccmd' configuration value. Default is the value of 'sendemail.cccmd' configuration value.
--[no-]chain-reply-to=<identifier>:: --[no-]chain-reply-to::
If this is set, each email will be sent as a reply to the previous If this is set, each email will be sent as a reply to the previous
email sent. If disabled with "--no-chain-reply-to", all emails after 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 the first will be sent as replies to the first email sent. When using
@ -214,7 +214,8 @@ specified, as well as 'body' if --no-signed-off-cc is specified.
--[no-]thread:: --[no-]thread::
If this is set, the In-Reply-To header will be set on each email sent. If this is set, the In-Reply-To header will be set on each email sent.
If disabled with "--no-thread", no emails will have the In-Reply-To If disabled with "--no-thread", no emails will have the In-Reply-To
header set. Default is the value of the 'sendemail.thread' configuration header set, unless specified with --in-reply-to.
Default is the value of the 'sendemail.thread' configuration
value; if that is unspecified, default to --thread. value; if that is unspecified, default to --thread.

View File

@ -812,7 +812,7 @@ sub sanitize_address
} }
# Returns 1 if the message was sent, and 0 otherwise. # Returns 1 if the message was sent, and 0 otherwise.
# In actuality, the whole program dies when a there # In actuality, the whole program dies when there
# is an error sending a message. # is an error sending a message.
sub send_message sub send_message
@ -1150,7 +1150,8 @@ foreach my $t (@files) {
my $message_was_sent = send_message(); my $message_was_sent = send_message();
# set up for the next message # set up for the next message
if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) { if ($thread && $message_was_sent &&
($chain_reply_to || !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";

View File

@ -621,4 +621,25 @@ test_expect_success 'in-reply-to but no threading' '
grep "In-Reply-To: <in-reply-id@example.com>" grep "In-Reply-To: <in-reply-id@example.com>"
' '
test_expect_success 'no in-reply-to and no threading' '
git send-email \
--dry-run \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--nothread \
$patches $patches >stdout &&
! grep "In-Reply-To: " stdout
'
test_expect_success 'threading but no chain-reply-to' '
git send-email \
--dry-run \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--thread \
--nochain-reply-to \
$patches $patches >stdout &&
grep "In-Reply-To: " stdout
'
test_done test_done