--- /dev/null
+Return-Path: <five9a2@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id A11CA431FBC\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Nov 2009 10:01:55 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id cGvr5Nbzu79S for <notmuch@notmuchmail.org>;\r
+ Wed, 25 Nov 2009 10:01:55 -0800 (PST)\r
+Received: from mail-bw0-f224.google.com (mail-bw0-f224.google.com\r
+ [209.85.218.224])\r
+ by olra.theworths.org (Postfix) with ESMTP id DAF57431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Nov 2009 10:01:54 -0800 (PST)\r
+Received: by bwz24 with SMTP id 24so6126486bwz.30\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Nov 2009 10:01:54 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=domainkey-signature:received:received:sender:from:to:cc:subject\r
+ :date:message-id:x-mailer:in-reply-to:references;\r
+ bh=nZ/y5xIvWj1QLyDMBDEisCWt3qSjS63dr+EcLt0j5nI=;\r
+ b=XDWFqmvEEG25kcmlV2z3Sfi/9EFkUHc6nB4Q12OwNficvBTOh0Cc82dsgZmkNs0A+z\r
+ o3Qp4MuYZLhNqh1zSqKrtVZ8ICUSO0DjbSoWjt68teODUt97SS+GI2rN7Ku//gMHw5og\r
+ 0ZxnVk8LJlQAW38XK1MeDSYy1hgTV+D9Ayyxs=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+ h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+ :references;\r
+ b=H3gq0vL0+464pGY4myZrncBZD2yB028yQi9abKKSOB+BXekGBzGnUIJ2f2tihGVow2\r
+ cuvTnC6kYw5fVYFaMzIFDBfX7CbMSAoME/YxRzK67usrumvjJDKtjC/ugFQ5dSLbOiSc\r
+ 9FBFHP8yUbWC8KYXGf8Z4wewpSOSI5hrAvnIs=\r
+Received: by 10.204.7.87 with SMTP id c23mr7792334bkc.97.1259172113731;\r
+ Wed, 25 Nov 2009 10:01:53 -0800 (PST)\r
+Received: from localhost.localdomain (vawpc43.ethz.ch [129.132.59.11])\r
+ by mx.google.com with ESMTPS id k29sm8997651fkk.51.2009.11.25.10.01.52\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Wed, 25 Nov 2009 10:01:52 -0800 (PST)\r
+Sender: Jed Brown <five9a2@gmail.com>\r
+From: Jed Brown <jed@59A2.org>\r
+To: notmuch@notmuchmail.org\r
+Date: Wed, 25 Nov 2009 19:02:18 +0100\r
+Message-Id: <1259172139-3274-1-git-send-email-jed@59A2.org>\r
+X-Mailer: git-send-email 1.6.5.3\r
+In-Reply-To: <1259112914-19806-2-git-send-email-jed@59A2.org>\r
+References: <1259112914-19806-2-git-send-email-jed@59A2.org>\r
+Subject: [notmuch] [PATCH 1/2] reply --format=headers-only: set In-Reply-To\r
+ header, with ID *last* in References\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 25 Nov 2009 18:01:55 -0000\r
+\r
+Apparently this is actually the correct way to do it, it's silly to do\r
+it wrong just to conform to one of git's internal data structures.\r
+---\r
+ notmuch-reply.c | 12 ++++++++----\r
+ 1 files changed, 8 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index e85568c..9ca1236 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -310,15 +310,19 @@ notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, notmuch_q\r
+ in_reply_to = talloc_asprintf (ctx, "<%s>",\r
+ notmuch_message_get_message_id (message));\r
+ \r
++ g_mime_object_set_header (GMIME_OBJECT (reply),\r
++ "In-Reply-To", in_reply_to);\r
++\r
++\r
+ orig_references = notmuch_message_get_header (message, "references");\r
+ \r
+- /* We print References first because git format-patch treats it specially.\r
+- * Git uses the first entry of References to create In-Reply-To.\r
++ /* We print In-Reply-To followed by References because git format-patch treats them\r
++ * specially. Git does not interpret the other headers specially\r
+ */\r
+ references = talloc_asprintf (ctx, "%s%s%s",\r
+- in_reply_to,\r
+ orig_references ? orig_references : "",\r
+- orig_references ? " " : "");\r
++ orig_references ? " " : "",\r
++ in_reply_to);\r
+ g_mime_object_set_header (GMIME_OBJECT (reply),\r
+ "References", references);\r
+ \r
+-- \r
+1.6.5.3\r
+\r