Re: notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / db / 7012e14055fd9a9146f3bf96dc2df4f09a981a
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id B104A429E26\r
6         for <notmuch@notmuchmail.org>; Thu, 15 Aug 2013 10:27:51 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id wf8A93JRZHB5 for <notmuch@notmuchmail.org>;\r
16         Thu, 15 Aug 2013 10:27:46 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id B73A2431FC2\r
20         for <notmuch@notmuchmail.org>; Thu, 15 Aug 2013 10:27:46 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7fa58e000000953-5a-520d0f92e805\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id EB.47.02387.29F0D025; Thu, 15 Aug 2013 13:27:46 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r7FHRgK1000756; \r
27         Thu, 15 Aug 2013 13:27:42 -0400\r
28 Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7FHReeN009075\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Thu, 15 Aug 2013 13:27:41 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1VA1Km-00053e-05; Thu, 15 Aug 2013 13:27:40 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v2 2/3] reply: Remove extraneous space from generated\r
40         References\r
41 Date: Thu, 15 Aug 2013 13:27:37 -0400\r
42 Message-Id: <1376587658-19202-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <1376587658-19202-1-git-send-email-amdragon@mit.edu>\r
45 References: <1376587658-19202-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsUixCmqrTuJnzfI4NIvNovrN2cyW7xZOY/V\r
48         gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4MpY8/Ycc8EUkYppXVNYGxibBLoYOTgkBEwk\r
49         3l1X72LkBDLFJC7cW8/WxcjFISSwj1Fi0fFNLBDORkaJFy+WMUI4R5gk/i38xw7hzGWUaH+9\r
50         kB2kn01AQ2Lb/uWMILaIgLTEzruzWUFsZgEricNXN4HZwgIBEpca9oDZLAKqEsv/X2ADsXkF\r
51         HCQe9+xjhLhDUaL72QSwOKeAo8TKCffA4kJANfsXnmGbwMi/gJFhFaNsSm6Vbm5iZk5xarJu\r
52         cXJiXl5qka6JXm5miV5qSukmRnAoSfLvYPx2UOkQowAHoxIPb0Qbd5AQa2JZcWXuIUZJDiYl\r
53         Ud59fLxBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4v97jCRLiTUmsrEotyodJSXOwKInzPnt6\r
54         NlBIID2xJDU7NbUgtQgmK8PBoSTBGw4yVLAoNT21Ii0zpwQhzcTBCTKcB2h4KkgNb3FBYm5x\r
55         ZjpE/hSjLseFwws/MQqx5OXnpUqJ80aCFAmAFGWU5sHNgaWAV4ziQG8J85aDVPEA0wfcpFdA\r
56         S5iAljhkc4EsKUlESEk1MLa39FX630mbbscc7BLP2aSp9flNl2D/xnuTy9dl8ir08mfpLo51\r
57         Oc459bnwZqV8n5D1TrZWnlo7Zn+btXn7g10KRTzRaQv69P+f9Slsf7TjTLjJ2eAjYo/a7Nmb\r
58         Giy3Rpnl/TRLP3Dg7NsFGwLORNTlFVvpVe/WWRoUYrlwuTWvym1hyy4nJZbijERDLeai4kQA\r
59         n6KB4twCAAA=\r
60 Cc: tomi.ollila@iki.fi\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Thu, 15 Aug 2013 17:27:52 -0000\r
74 \r
75 Previously, the References header code seemed to assume\r
76 notmuch_message_get_header would return NULL if the header was not\r
77 present, but it actually returns "".  As a result of this, it was\r
78 inserting an unnecessary space when concatenating an empty or missing\r
79 original references header with the new reference.\r
80 \r
81 This shows up in only two tests because the text reply format later\r
82 passes the whole reply template through g_mime_filter_headers, which\r
83 has the side effect of stripping out this extra space.\r
84 ---\r
85  notmuch-reply.c |   14 ++++++++------\r
86  test/multipart  |    2 +-\r
87  test/reply      |    2 +-\r
88  3 files changed, 10 insertions(+), 8 deletions(-)\r
89 \r
90 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
91 index 3b2b58d..0f3b9cd 100644\r
92 --- a/notmuch-reply.c\r
93 +++ b/notmuch-reply.c\r
94 @@ -537,12 +537,14 @@ create_reply_message(void *ctx,\r
95                               "In-Reply-To", in_reply_to);\r
96  \r
97      orig_references = notmuch_message_get_header (message, "references");\r
98 -    references = talloc_asprintf (ctx, "%s%s%s",\r
99 -                                 orig_references ? orig_references : "",\r
100 -                                 orig_references ? " " : "",\r
101 -                                 in_reply_to);\r
102 -    g_mime_object_set_header (GMIME_OBJECT (reply),\r
103 -                             "References", references);\r
104 +    if (orig_references) {\r
105 +       references = talloc_asprintf (ctx, "%s%s%s",\r
106 +                                     *orig_references ? orig_references : "",\r
107 +                                     *orig_references ? " " : "",\r
108 +                                     in_reply_to);\r
109 +       g_mime_object_set_header (GMIME_OBJECT (reply),\r
110 +                                 "References", references);\r
111 +    }\r
112  \r
113      return reply;\r
114  }\r
115 diff --git a/test/multipart b/test/multipart\r
116 index c974226..2033023 100755\r
117 --- a/test/multipart\r
118 +++ b/test/multipart\r
119 @@ -599,7 +599,7 @@ cat <<EOF >EXPECTED\r
120   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
121   "To": "Carl Worth <cworth@cworth.org>, cworth@cworth.org",\r
122   "In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>",\r
123 - "References": " <87liy5ap00.fsf@yoom.home.cworth.org>"},\r
124 + "References": "<87liy5ap00.fsf@yoom.home.cworth.org>"},\r
125   "original": {"id": "XXXXX",\r
126   "match": false,\r
127   "excluded": false,\r
128 diff --git a/test/reply b/test/reply\r
129 index c877ffe..a85ebe5 100755\r
130 --- a/test/reply\r
131 +++ b/test/reply\r
132 @@ -242,7 +242,7 @@ test_expect_equal_json "$output" '\r
133      "reply-headers": {\r
134          "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
135          "In-reply-to": "<'${gen_msg_id}'>",\r
136 -        "References": " <'${gen_msg_id}'>",\r
137 +        "References": "<'${gen_msg_id}'>",\r
138          "Subject": "Re: \u00e0\u00df\u00e7",\r
139          "To": "\u2603 <snowman@example.com>"\r
140      }\r
141 -- \r
142 1.7.10.4\r
143 \r