path: root/log-tree.c
diff options
authorThomas Rast <>2009-02-19 21:26:31 (GMT)
committerJunio C Hamano <>2009-02-22 04:26:03 (GMT)
commitb079c50e03a812f5c8197b8f38e0a5fe6dd31321 (patch)
treebe6aa158cc92221b3db7df40aa792dfb904bdaca /log-tree.c
parent484cf6c3f1169786c45ccda54c9961ef66465c03 (diff)
format-patch: track several references
Currently, format-patch can only track a single reference (the In-Reply-To:) for each mail. To ensure proper threading, we should list all known references for every mail. Change the rev_info.ref_message_id field to a string_list, so that we can append references at will, and change the output formatting routines to print all of them in the References: header. The last entry in the list is implicitly assumed to be the In-Reply-To:, which gives output consistent with RFC 2822: The "References:" field will contain the contents of the parent's "References:" field (if any) followed by the contents of the parent's "Message-ID:" field (if any). Note that this is just preparatory work; nothing uses it yet, so all "References:" fields in the output are still only one deep. Signed-off-by: Thomas Rast <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'log-tree.c')
1 files changed, 8 insertions, 3 deletions
diff --git a/log-tree.c b/log-tree.c
index 84a74e5..a315ebb 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -6,6 +6,7 @@
#include "log-tree.h"
#include "reflog-walk.h"
#include "refs.h"
+#include "string-list.h"
struct decoration name_decoration = { "object names" };
@@ -211,9 +212,13 @@ void log_write_email_headers(struct rev_info *opt, const char *name,
printf("Message-Id: <%s>\n", opt->message_id);
- if (opt->ref_message_id) {
- printf("In-Reply-To: <%s>\nReferences: <%s>\n",
- opt->ref_message_id, opt->ref_message_id);
+ if (opt->ref_message_ids && opt->ref_message_ids->nr > 0) {
+ int i, n;
+ n = opt->ref_message_ids->nr;
+ printf("In-Reply-To: <%s>\n", opt->ref_message_ids->items[n-1].string);
+ for (i = 0; i < n; i++)
+ printf("%s<%s>\n", (i > 0 ? "\t" : "References: "),
+ opt->ref_message_ids->items[i].string);
if (opt->mime_boundary) {