From 2175c10d5ad2769936f5bf5bcca5ea32715a7307 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Thu, 19 Feb 2009 22:26:32 +0100 Subject: [PATCH] format-patch: thread as reply to cover letter even with in-reply-to Currently, format-patch --thread --cover-letter --in-reply-to $parent makes all mails, including the cover letter, a reply to $parent. However, we would want the reader to consider the cover letter above all the patches. This changes the semantics so that only the cover letter is a reply to $parent, while all the patches are formatted as replies to the cover letter. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- builtin-log.c | 20 +++++++++++++++----- t/t4014-format-patch.sh | 9 ++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 59671139b8..1df38e17a2 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -1036,12 +1036,22 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) /* Have we already had a message ID? */ if (rev.message_id) { /* - * If we've got the ID to be a reply - * to, discard the current ID; - * otherwise, make everything a reply - * to that. + * Without --cover-letter and + * --in-reply-to, make every mail a + * reply to the one before. + * + * With --in-reply-to but no + * --cover-letter, make every mail a + * reply to the . + * + * With --cover-letter, make every + * mail but the cover letter a reply + * to the cover letter. The cover + * letter is a reply to the + * --in-reply-to, if specified. */ - if (rev.ref_message_ids->nr > 0) + if (rev.ref_message_ids->nr > 0 + && (!cover_letter || rev.nr > 1)) free(rev.message_id); else string_list_append(rev.message_id, diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 345e6deab6..8b970c39a2 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -237,16 +237,19 @@ In-Reply-To: <1> References: <1> --- Message-Id: <2> -In-Reply-To: <1> +In-Reply-To: <0> References: <1> + <0> --- Message-Id: <3> -In-Reply-To: <1> +In-Reply-To: <0> References: <1> + <0> --- Message-Id: <4> -In-Reply-To: <1> +In-Reply-To: <0> References: <1> + <0> EOF test_expect_success 'thread cover-letter in-reply-to' ' -- 2.11.4.GIT