Skip to content

Commit 08ba248

Browse files
committed
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
2 parents e248619 + 95a877a commit 08ba248

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

Documentation/git-send-email.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Automating
165165
Output of this command must be single email address per line.
166166
Default is the value of 'sendemail.cccmd' configuration value.
167167

168-
--[no-]chain-reply-to=<identifier>::
168+
--[no-]chain-reply-to::
169169
If this is set, each email will be sent as a reply to the previous
170170
email sent. If disabled with "--no-chain-reply-to", all emails after
171171
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.
214214
--[no-]thread::
215215
If this is set, the In-Reply-To header will be set on each email sent.
216216
If disabled with "--no-thread", no emails will have the In-Reply-To
217-
header set. Default is the value of the 'sendemail.thread' configuration
217+
header set, unless specified with --in-reply-to.
218+
Default is the value of the 'sendemail.thread' configuration
218219
value; if that is unspecified, default to --thread.
219220

220221

git-send-email.perl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ sub sanitize_address
812812
}
813813

814814
# Returns 1 if the message was sent, and 0 otherwise.
815-
# In actuality, the whole program dies when a there
815+
# In actuality, the whole program dies when there
816816
# is an error sending a message.
817817

818818
sub send_message
@@ -1150,7 +1150,8 @@ sub send_message
11501150
my $message_was_sent = send_message();
11511151

11521152
# set up for the next message
1153-
if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) {
1153+
if ($thread && $message_was_sent &&
1154+
($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {
11541155
$reply_to = $message_id;
11551156
if (length $references > 0) {
11561157
$references .= "\n $message_id";

t/t9001-send-email.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,4 +621,25 @@ test_expect_success 'in-reply-to but no threading' '
621621
grep "In-Reply-To: <[email protected]>"
622622
'
623623

624+
test_expect_success 'no in-reply-to and no threading' '
625+
git send-email \
626+
--dry-run \
627+
--from="Example <[email protected]>" \
628+
629+
--nothread \
630+
$patches $patches >stdout &&
631+
! grep "In-Reply-To: " stdout
632+
'
633+
634+
test_expect_success 'threading but no chain-reply-to' '
635+
git send-email \
636+
--dry-run \
637+
--from="Example <[email protected]>" \
638+
639+
--thread \
640+
--nochain-reply-to \
641+
$patches $patches >stdout &&
642+
grep "In-Reply-To: " stdout
643+
'
644+
624645
test_done

0 commit comments

Comments
 (0)