summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-send-email.txt5
-rwxr-xr-xgit-send-email.perl5
-rwxr-xr-xt/t9001-send-email.sh21
3 files changed, 27 insertions, 4 deletions
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index e7cb0e6c71..9902da43c7 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -165,7 +165,7 @@ Automating
Output of this command must be single email address per line.
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
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
@@ -214,7 +214,8 @@ specified, as well as 'body' if --no-signed-off-cc is specified.
--[no-]thread::
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
- 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.
diff --git a/git-send-email.perl b/git-send-email.perl
index 4c795a4b03..303e03a8ce 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -812,7 +812,7 @@ sub sanitize_address
}
# 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.
sub send_message
@@ -1150,7 +1150,8 @@ foreach my $t (@files) {
my $message_was_sent = send_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;
if (length $references > 0) {
$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 2ce24cd5a6..9ce04fd472 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,4 +621,25 @@ test_expect_success 'in-reply-to but no threading' '
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