Skip to content

Commit 2175c10

Browse files
trastgitster
authored andcommitted
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 <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b079c50 commit 2175c10

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

builtin-log.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,12 +1036,22 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
10361036
/* Have we already had a message ID? */
10371037
if (rev.message_id) {
10381038
/*
1039-
* If we've got the ID to be a reply
1040-
* to, discard the current ID;
1041-
* otherwise, make everything a reply
1042-
* to that.
1039+
* Without --cover-letter and
1040+
* --in-reply-to, make every mail a
1041+
* reply to the one before.
1042+
*
1043+
* With --in-reply-to but no
1044+
* --cover-letter, make every mail a
1045+
* reply to the <reply-to>.
1046+
*
1047+
* With --cover-letter, make every
1048+
* mail but the cover letter a reply
1049+
* to the cover letter. The cover
1050+
* letter is a reply to the
1051+
* --in-reply-to, if specified.
10431052
*/
1044-
if (rev.ref_message_ids->nr > 0)
1053+
if (rev.ref_message_ids->nr > 0
1054+
&& (!cover_letter || rev.nr > 1))
10451055
free(rev.message_id);
10461056
else
10471057
string_list_append(rev.message_id,

t/t4014-format-patch.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,19 @@ In-Reply-To: <1>
237237
References: <1>
238238
---
239239
Message-Id: <2>
240-
In-Reply-To: <1>
240+
In-Reply-To: <0>
241241
References: <1>
242+
<0>
242243
---
243244
Message-Id: <3>
244-
In-Reply-To: <1>
245+
In-Reply-To: <0>
245246
References: <1>
247+
<0>
246248
---
247249
Message-Id: <4>
248-
In-Reply-To: <1>
250+
In-Reply-To: <0>
249251
References: <1>
252+
<0>
250253
EOF
251254

252255
test_expect_success 'thread cover-letter in-reply-to' '

0 commit comments

Comments
 (0)