From 32ae83194b0f287a9b6644cdad175c56417c31f3 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 12:51:37 +0200 Subject: [PATCH 1/6] add a test for git-send-email for non-threaded mails Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index ce26ea4ac..5bfa36ecc 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -621,4 +621,14 @@ test_expect_success 'in-reply-to but no threading' ' grep "In-Reply-To: " ' +test_expect_failure 'no in-reply-to and no threading' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to=nobody@example.com \ + --nothread \ + $patches $patches >stdout && + ! grep "In-Reply-To: " stdout +' + test_done From 5e9758e2968238906c730c9c77ecc95c21e7495e Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 12:51:38 +0200 Subject: [PATCH 2/6] send-email: fix non-threaded mails After commit 3e0c4ff (send-email: respect in-reply-to regardless of threading, 2009-03-01) the variable $thread was only used for prompting for an "In-Reply-To", but not for controlling whether the "In-Reply-To" and "References" fields should be written into the email. Thus these fields were always used beginning with the second mail and it was not possible to produce non-threaded mails anymore. However, a later commit 15da108 ("send-email: 'References:' should only reference what is sent", 2009-04-13) introduced a regression with the side effect to make non-threaded mails possible again, but only when --no-chain-reply-to was used. Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- git-send-email.perl | 3 ++- t/t9001-send-email.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index cccbf4517..5d5169707 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1137,7 +1137,8 @@ sub send_message send_message(); # set up for the next message - if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) { + if ($thread && + ($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 5bfa36ecc..8518acaca 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' ' grep "In-Reply-To: " ' -test_expect_failure 'no in-reply-to and no threading' ' +test_expect_success 'no in-reply-to and no threading' ' git send-email \ --dry-run \ --from="Example " \ From 0fd41f2d66fdb7c8125f341c72f075aca045017f Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 12:51:39 +0200 Subject: [PATCH 3/6] doc/send-email: clarify the behavior of --in-reply-to with --no-thread Also remove the argument from --[no-]chain-reply-to. Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- Documentation/git-send-email.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index a2821907c..0ec53431a 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -159,7 +159,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=:: +--[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 @@ -208,7 +208,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. From d67114a5f3cbbedd4f01e6ff87fd5d4db9563ead Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 12:51:40 +0200 Subject: [PATCH 4/6] add a test for git-send-email for threaded mails without chain-reply-to Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 2ce24cd5a..4f67de3ac 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -621,4 +621,15 @@ test_expect_success 'in-reply-to but no threading' ' grep "In-Reply-To: " ' +test_expect_failure 'threading but no chain-reply-to' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to=nobody@example.com \ + --thread \ + --nochain-reply-to \ + $patches $patches >stdout && + grep "In-Reply-To: " stdout +' + test_done From f74fe34b96816bad1f568202ec51ef18ae7513b3 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 12:51:41 +0200 Subject: [PATCH 5/6] send-email: fix threaded mails without chain-reply-to An earlier commit 15da108 ("send-email: 'References:' should only reference what is sent", 2009-04-13) broke logic to set up threading information for the next message by rewriting "!" to "not" without understanding the precedence rules of the language. Namely, ! defined $reply_to || length($reply_to) == 0 was changed to not defined $reply_to || length($reply_to) == 0 which is not (defined $reply_to || length($reply_to) == 0) and different from what was intended, which is (not defined $reply_to) || (length($reply_to) == 0) Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- git-send-email.perl | 3 ++- t/t9001-send-email.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 4c795a4b0..16d12e082 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1150,7 +1150,8 @@ sub send_message 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 ($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 4f67de3ac..8ab1a78bf 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' ' grep "In-Reply-To: " ' -test_expect_failure 'threading but no chain-reply-to' ' +test_expect_success 'threading but no chain-reply-to' ' git send-email \ --dry-run \ --from="Example " \ From a1b5b371994beb044053da22ec4a9607630a83a2 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 12:51:42 +0200 Subject: [PATCH 6/6] send-email: fix a typo in a comment Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- git-send-email.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-send-email.perl b/git-send-email.perl index 16d12e082..4a77d445c 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