--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 425CB431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 12 Aug 2013 11:41:03 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 cnZ0d3GbmTdM for <notmuch@notmuchmail.org>;\r
+ Mon, 12 Aug 2013 11:40:58 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
+ [18.9.25.13])\r
+ by olra.theworths.org (Postfix) with ESMTP id 76E65431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 12 Aug 2013 11:40:53 -0700 (PDT)\r
+X-AuditID: 1209190d-b7f078e000000937-98-52092c343689\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 6D.46.02359.43C29025; Mon, 12 Aug 2013 14:40:52 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r7CIeqRp011677; \r
+ Mon, 12 Aug 2013 14:40:52 -0400\r
+Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7CIemRi003750\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Mon, 12 Aug 2013 14:40:50 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1V8x2u-0005yg-Nf; Mon, 12 Aug 2013 14:40:48 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 5/6] reply: Remove extraneous space from generated References\r
+Date: Mon, 12 Aug 2013 14:40:38 -0400\r
+Message-Id: <1376332839-22825-6-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1376332839-22825-1-git-send-email-amdragon@mit.edu>\r
+References: <1376332839-22825-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrHIsWRmVeSWpSXmKPExsUixG6nomuiwxlkcPSvqcX1mzOZHRg9nq26\r
+ xRzAGMVlk5Kak1mWWqRvl8CVMWPhM+aCDoGKDQefszcwfuPpYuTkkBAwkfh8sp0VwhaTuHBv\r
+ PVsXIxeHkMA+Rok1e7azQzgbGSVO9V1lAqkSEjjCJPH+FydEYi6jxNxJ/9hBEmwCGhLb9i9n\r
+ BLFFBKQldt6dDTSWg4NZQE3iT5cKSFhYwFdiwfQWsBIWAVWJT99vgrXyCjhIrG5bAHWFokT3\r
+ swlsIDangKPE/eXnWCD2Okhs3NXDOIGRfwEjwypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdI73c\r
+ zBK91JTSTYygoOGU5N3B+O6g0iFGAQ5GJR7ejI8cQUKsiWXFlbmHGCU5mJREeSdpcgYJ8SXl\r
+ p1RmJBZnxBeV5qQWH2KU4GBWEuHdwgqU401JrKxKLcqHSUlzsCiJ8z59ejZQSCA9sSQ1OzW1\r
+ ILUIJivDwaEkwRuqDdQoWJSanlqRlplTgpBm4uAEGc4DNNwdpIa3uCAxtzgzHSJ/ilGX48Lh\r
+ hZ8YhVjy8vNSpcR5LUCKBECKMkrz4ObAov0VozjQW8K8viBVPMBEATfpFdASJqAlRs0cIEtK\r
+ EhFSUg2MyeGB6eW9zYltd1kdJ/cWvJW6n6p/PYPxGZt3nfOzmQYbje9f7RZ8s0/l5tbDq2SW\r
+ XHz46Wd8ULBTWtCLhXHu8xh4Z+wL+haUsDNgnfy2d1rf7zaf7a3ZcezSbamOXXEs0V4r1S1u\r
+ /2Zk0twosrXo4YpnjxbuORPQ0v3P5k13esG/sz23Voa9VWIpzkg01GIuKk4EAI3c8+rRAgAA\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Mon, 12 Aug 2013 18:41:03 -0000\r
+\r
+Previously, the References header code seemed to assume\r
+notmuch_message_get_header would return NULL if the header was not\r
+present, but it actually returns "". As a result of this, it was\r
+inserting an unnecessary space when concatenating an empty or missing\r
+original references header with the new reference.\r
+\r
+This shows up in only one test because the text reply format later\r
+passes the whole reply template through g_mime_filter_headers, which\r
+has the side effect of stripping out this extra space.\r
+---\r
+ notmuch-reply.c | 14 ++++++++------\r
+ test/multipart | 2 +-\r
+ 2 files changed, 9 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 3b2b58d..0f3b9cd 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -537,12 +537,14 @@ create_reply_message(void *ctx,\r
+ "In-Reply-To", in_reply_to);\r
+ \r
+ orig_references = notmuch_message_get_header (message, "references");\r
+- references = talloc_asprintf (ctx, "%s%s%s",\r
+- orig_references ? orig_references : "",\r
+- orig_references ? " " : "",\r
+- in_reply_to);\r
+- g_mime_object_set_header (GMIME_OBJECT (reply),\r
+- "References", references);\r
++ if (orig_references) {\r
++ references = talloc_asprintf (ctx, "%s%s%s",\r
++ *orig_references ? orig_references : "",\r
++ *orig_references ? " " : "",\r
++ in_reply_to);\r
++ g_mime_object_set_header (GMIME_OBJECT (reply),\r
++ "References", references);\r
++ }\r
+ \r
+ return reply;\r
+ }\r
+diff --git a/test/multipart b/test/multipart\r
+index c974226..2033023 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -599,7 +599,7 @@ cat <<EOF >EXPECTED\r
+ "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+ "To": "Carl Worth <cworth@cworth.org>, cworth@cworth.org",\r
+ "In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>",\r
+- "References": " <87liy5ap00.fsf@yoom.home.cworth.org>"},\r
++ "References": "<87liy5ap00.fsf@yoom.home.cworth.org>"},\r
+ "original": {"id": "XXXXX",\r
+ "match": false,\r
+ "excluded": false,\r
+-- \r
+1.7.10.4\r
+\r