reply --format=headers-only: set In-Reply-To header, with ID *last* in References

Apparently this is actually the correct way to do it, it's silly to do
it wrong just to conform to one of git's internal data structures.
This commit is contained in:
Jed Brown 2009-11-25 19:02:18 +01:00 committed by Carl Worth
parent f47e54bc51
commit 00b138ba2a

View file

@ -310,15 +310,19 @@ notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, notmuch_q
in_reply_to = talloc_asprintf (ctx, "<%s>", in_reply_to = talloc_asprintf (ctx, "<%s>",
notmuch_message_get_message_id (message)); notmuch_message_get_message_id (message));
g_mime_object_set_header (GMIME_OBJECT (reply),
"In-Reply-To", in_reply_to);
orig_references = notmuch_message_get_header (message, "references"); orig_references = notmuch_message_get_header (message, "references");
/* We print References first because git format-patch treats it specially. /* We print In-Reply-To followed by References because git format-patch treats them
* Git uses the first entry of References to create In-Reply-To. * specially. Git does not interpret the other headers specially
*/ */
references = talloc_asprintf (ctx, "%s%s%s", references = talloc_asprintf (ctx, "%s%s%s",
in_reply_to,
orig_references ? orig_references : "", orig_references ? orig_references : "",
orig_references ? " " : ""); orig_references ? " " : "",
in_reply_to);
g_mime_object_set_header (GMIME_OBJECT (reply), g_mime_object_set_header (GMIME_OBJECT (reply),
"References", references); "References", references);