From: Antonio Ospite <ospite@studenti.unina.it>
To: git@vger.kernel.org
Cc: Antonio Ospite <ospite@studenti.unina.it>,
Jonathan Nieder <jrnieder@gmail.com>,
Stephen Boyd <bebarino@gmail.com>,
Markus Heidelberg <markus.heidelberg@web.de>,
Nanako Shiraishi <nanako3@lavabit.com>
Subject: [PATCH v2] git-send-email.perl: fix In-Reply-To for second and subsequent patches
Date: Tue, 19 Oct 2010 11:52:44 +0200 [thread overview]
Message-ID: <1287481964-8883-1-git-send-email-ospite@studenti.unina.it> (raw)
In-Reply-To: <20101015095651.b75c4b54.ospite@studenti.unina.it>
Make second and subsequent patches appear as replies to the first patch,
even when an initial In-Reply-To is supplied; this is the typical
behaviour we want when we send a series with cover letter in reply to
some discussion, and this is also what the man page says about
the --in-reply-to option.
When $initial_reply_to is asked to the user interactively it is asked as
the "Message-ID to be used as In-Reply-To for the _first_ email", this
makes the user think that the second and subsequent patches are not
using it but are considered as replies to the first message or chained
according to the --[no-]chain-reply setting.
In order to achieve the old behaviour of a flat structure in reply to
something the user can always use "--no-thread --in-reply-to <...>".
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
Changes since v1:
- add more details about the interactive case in the commit message
- split long line as requested by Jonathan Nieder
- add a test case in t/t9001-send-email.sh, please check that, I am not
comparing the strings inside '<>' is it necessary to be so strict?
Note to self: remember to run 'make' before running t9001-send-email.sh :)
Thanks,
Antonio Ospite
http://ao2.it
git-send-email.perl | 3 ++-
t/t9001-send-email.sh | 14 ++++++++++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 8cc4161..bc4e318 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1313,7 +1313,8 @@ 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 ||
+ $message_num == 1)) {
$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 a298eb0..410b85f 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -295,6 +295,20 @@ test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
! grep "^In-Reply-To: < *>" msgtxt1
'
+test_expect_success $PREREQ 'In-Reply-To in second patch with --thread' '
+ clean_fake_sendmail &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --thread \
+ --in-reply-to="<unique-message-id@example.com>" \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches $patches \
+ 2>errors
+ # The second patch should be seen as reply to the first one
+ test $(sed -n -e "s/^In-Reply-To:\(.*\)/\1/p" msgtxt2) = $(sed -n -e "s/^Message-Id:\(.*\)/\1/p" msgtxt1)
+'
+
test_expect_success $PREREQ 'setup fake editor' '
(echo "#!$SHELL_PATH" &&
echo "echo fake edit >>\"\$1\""
--
1.7.2.3
next prev parent reply other threads:[~2010-10-19 9:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 9:38 [PATCH] git-send-email.perl: fix In-Reply-To for second and subsequent patches Antonio Ospite
2010-10-14 18:22 ` Jonathan Nieder
2010-10-15 7:56 ` Antonio Ospite
2010-10-19 9:52 ` Antonio Ospite [this message]
2010-10-19 18:26 ` [PATCH v2] " Junio C Hamano
2010-10-19 18:45 ` Junio C Hamano
2010-10-19 22:45 ` Antonio Ospite
2010-10-26 13:50 ` Antonio Ospite
2010-11-05 20:59 ` [PATCH v3] git-send-email.perl: make initial In-Reply-To apply only to first email Antonio Ospite
2010-11-05 22:36 ` Matthieu Moy
2010-11-09 21:23 ` Junio C Hamano
2010-11-10 11:45 ` Antonio Ospite
2010-11-10 19:48 ` Junio C Hamano
2010-11-12 14:55 ` [PATCHi v4] " Antonio Ospite
2010-11-12 20:53 ` Junio C Hamano
2010-11-12 21:44 ` Junio C Hamano
2010-11-12 22:51 ` Antonio Ospite
2010-11-05 21:41 ` [PATCH v2] git-send-email.perl: fix In-Reply-To for second and subsequent patches Jonathan Nieder
2010-11-08 11:03 ` Antonio Ospite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287481964-8883-1-git-send-email-ospite@studenti.unina.it \
--to=ospite@studenti.unina.it \
--cc=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=markus.heidelberg@web.de \
--cc=nanako3@lavabit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).