Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 15 / 3d92a4a86f52fad877d4abdca948ebb5979370
1 Return-Path: <aaronecay@gmail.com>\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 37BBC431FAE\r
6         for <notmuch@notmuchmail.org>; Sun,  3 Mar 2013 15:56:05 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id V1DnH4WHTqq1 for <notmuch@notmuchmail.org>;\r
17         Sun,  3 Mar 2013 15:56:01 -0800 (PST)\r
18 Received: from mail-qe0-f43.google.com (mail-qe0-f43.google.com\r
19         [209.85.128.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 95EFB431FAF\r
22         for <notmuch@notmuchmail.org>; Sun,  3 Mar 2013 15:56:01 -0800 (PST)\r
23 Received: by mail-qe0-f43.google.com with SMTP id 1so3362385qee.16\r
24         for <notmuch@notmuchmail.org>; Sun, 03 Mar 2013 15:56:01 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=x-received:from:to:cc:subject:in-reply-to:references:user-agent\r
27         :date:message-id:mime-version:content-type;\r
28         bh=35z6Zyv+gYqaZZOgfJ0ZKm7sQt0qSjkJLHQIq+Sw1po=;\r
29         b=BLlyMlDCOvZww549uMory2/3a8Re1qe8fq06U7U/4EpMrbZJJcCVZFgqw/aU/PZENj\r
30         cR8y/MTb7hrKcNiHsiBmyM4iN1I9EcIq3JQyrQWSbE9XmBYHCnauh1jYwZmW9Ao8GR4o\r
31         AxfKUKU0Z37RfCJtsrQ3VYhIQbc745fV4pkuSQQDWLvNbSnNQeUQL3cQ1sWvFVX5Ysgo\r
32         1UuUJECs2AQpUymxB4ITzBuo1zLZtVMkxgJoQ2XOPAvDHaTc0dviwxnZvYbqWUeUHNye\r
33         izoZPRY1vAS2DivKhcYOXhtUSkc2/qecwDptftaQFRf0xJDzxOi6h32LrkQC0oiRJ4cP\r
34         rZBA==\r
35 X-Received: by 10.229.196.138 with SMTP id eg10mr6324192qcb.93.1362354961024; \r
36         Sun, 03 Mar 2013 15:56:01 -0800 (PST)\r
37 Received: from localhost (c-68-80-94-73.hsd1.pa.comcast.net. [68.80.94.73])\r
38         by mx.google.com with ESMTPS id m6sm3499808qed.7.2013.03.03.15.55.59\r
39         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
40         Sun, 03 Mar 2013 15:56:00 -0800 (PST)\r
41 From: Aaron Ecay <aaronecay@gmail.com>\r
42 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
43 Subject: Re: [RFC] [PATCH] lib/database.cc: change how the parent of a message\r
44         is calculated\r
45 In-Reply-To: <87wqtovygl.fsf@gmail.com>\r
46 References: <1361836225-17279-1-git-send-email-aaronecay@gmail.com>\r
47         <87621cteeb.fsf@nikula.org> <871ubzt5gr.fsf@nikula.org>\r
48         <87wqtovygl.fsf@gmail.com>\r
49 User-Agent: Notmuch/0.15.2+33~g0c0a530 (http://notmuchmail.org)\r
50         Emacs/24.3.50.2 (x86_64-unknown-linux-gnu)\r
51 Date: Sun, 03 Mar 2013 18:55:58 -0500\r
52 Message-ID: <87sj4cvy0h.fsf@gmail.com>\r
53 MIME-Version: 1.0\r
54 Content-Type: multipart/mixed; boundary="=-=-="\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Sun, 03 Mar 2013 23:56:05 -0000\r
68 \r
69 --=-=-=\r
70 Content-Type: text/plain; charset=utf-8\r
71 Content-Transfer-Encoding: quoted-printable\r
72 \r
73 git send-email is mad about lines >998 characters in the test patch, so\r
74 I=E2=80=99m sending the patches as attachments to this email.  (Is there a\r
75 better way to include the expected output of a notmuch command which\r
76 outputs long lines in a test script?)\r
77 \r
78 \r
79 --=-=-=\r
80 Content-Type: text/x-patch\r
81 Content-Disposition: inline;\r
82  filename=0001-test-add-tests-for-the-handling-of-References-and-In.patch\r
83 Content-Transfer-Encoding: quoted-printable\r
84 \r
85 >From 23836241dd304b98f2a05803fbb5a5a94f563050 Mon Sep 17 00:00:00 2001\r
86 From: Aaron Ecay <aaronecay@gmail.com>\r
87 Date: Sun, 3 Mar 2013 18:14:07 -0500\r
88 Subject: [PATCH 1/2] test: add tests for the handling of References and\r
89  In-Reply-To headers\r
90 \r
91 These tests are known_broken, the following commit fixes them.\r
92 ---\r
93  test/thread-replies | 55 +++++++++++++++++++++++++++++++++++++++++++++++++=\r
94 ++++\r
95  1 file changed, 55 insertions(+)\r
96  create mode 100755 test/thread-replies\r
97 \r
98 diff --git a/test/thread-replies b/test/thread-replies\r
99 new file mode 100755\r
100 index 0000000..fd11a09\r
101 --- /dev/null\r
102 +++ b/test/thread-replies\r
103 @@ -0,0 +1,55 @@\r
104 +#!/usr/bin/env bash\r
105 +#\r
106 +# Copyright (c) 2013 Aaron Ecay\r
107 +#\r
108 +\r
109 +test_description=3D'test of proper handling of in-reply-to and references =\r
110 headers\r
111 +\r
112 +This test makes sure that the thread structure in the notmuch database is\r
113 +constructed properly, even in the presence of non-RFC-compliant headers'\r
114 +\r
115 +. ./test-lib.sh\r
116 +\r
117 +test_begin_subtest "Use References when In-Reply-To is broken"\r
118 +test_subtest_known_broken\r
119 +add_message '[id]=3D"foo@one.com"' \\r
120 +    '[subject]=3Done'\r
121 +add_message '[in-reply-to]=3D"mumble"' \\r
122 +    '[references]=3D"<foo@one.com>"' \\r
123 +    '[subject]=3D"Re: one"'\r
124 +output=3D$(notmuch show --format=3Djson 'subject:one')\r
125 +test_expect_equal "$output" '[[[{"id": "foo@one.com", "match": true, "excl=\r
126 uded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/src/=\r
127 notmuch/test/tmp.thread-replies/mail/msg-001", "timestamp": 978709437, "dat=\r
128 e_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subjec=\r
129 t": "one", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To":=\r
130  "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Jan 20=\r
131 01 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "cont=\r
132 ent": "This is just a test message (#1)\n"}]}, [[{"id": "msg-002@notmuch-te=\r
133 st-suite", "match": true, "excluded": false, "filename": "/home/aecay/devel=\r
134 opment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-002=\r
135 ", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox",=\r
136  "unread"], "headers": {"Subject": "Re: one", "From": "Notmuch Test Suite <=\r
137 test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuch=\r
138 mail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, =\r
139 "content-type": "text/plain", "content": "This is just a test message (#2)\=\r
140 n"}]}, []]]]]]'\r
141 +\r
142 +test_begin_subtest "Prefer References to In-Reply-To"\r
143 +test_subtest_known_broken\r
144 +add_message '[id]=3D"foo@two.com"' \\r
145 +    '[subject]=3Dtwo'\r
146 +add_message '[in-reply-to]=3D"<bar@baz.com>"' \\r
147 +    '[references]=3D"<foo@two.com>"' \\r
148 +    '[subject]=3D"Re: two"'\r
149 +output=3D$(notmuch show --format=3Djson 'subject:two')\r
150 +test_expect_equal "$output" '[[[{"id": "foo@two.com", "match": true, "excl=\r
151 uded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/src/=\r
152 notmuch/test/tmp.thread-replies/mail/msg-003", "timestamp": 978709437, "dat=\r
153 e_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subjec=\r
154 t": "two", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To":=\r
155  "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Jan 20=\r
156 01 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "cont=\r
157 ent": "This is just a test message (#3)\n"}]}, [[{"id": "msg-004@notmuch-te=\r
158 st-suite", "match": true, "excluded": false, "filename": "/home/aecay/devel=\r
159 opment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-004=\r
160 ", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox",=\r
161  "unread"], "headers": {"Subject": "Re: two", "From": "Notmuch Test Suite <=\r
162 test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuch=\r
163 mail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, =\r
164 "content-type": "text/plain", "content": "This is just a test message (#4)\=\r
165 n"}]}, []]]]]]'\r
166 +\r
167 +test_begin_subtest "Use In-Reply-To when no References"\r
168 +test_subtest_known_broken\r
169 +add_message '[id]=3D"foo@three.com"' \\r
170 +    '[subject]=3D"three"'\r
171 +add_message '[in-reply-to]=3D"<foo@three.com>"' \\r
172 +    '[subject]=3D"Re: three"'\r
173 +output=3D$(notmuch show --format=3Djson 'subject:three')\r
174 +test_expect_equal "$output" '[[[{"id": "foo@three.com", "match": true, "ex=\r
175 cluded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/sr=\r
176 c/notmuch/test/tmp.thread-replies/mail/msg-005", "timestamp": 978709437, "d=\r
177 ate_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subj=\r
178 ect": "three", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "=\r
179 To": "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Ja=\r
180 n 2001 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "=\r
181 content": "This is just a test message (#5)\n"}]}, [[{"id": "msg-006@notmuc=\r
182 h-test-suite", "match": true, "excluded": false, "filename": "/home/aecay/d=\r
183 evelopment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg=\r
184 -006", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inb=\r
185 ox", "unread"], "headers": {"Subject": "Re: three", "From": "Notmuch Test S=\r
186 uite <test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@n=\r
187 otmuchmail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id=\r
188 ": 1, "content-type": "text/plain", "content": "This is just a test message=\r
189  (#6)\n"}]}, []]]]]]'\r
190 +\r
191 +test_begin_subtest "Use last Reference"\r
192 +test_subtest_known_broken\r
193 +add_message '[id]=3D"foo@four.com"' \\r
194 +    '[subject]=3D"four"'\r
195 +add_message '[id]=3D"bar@four.com"' \\r
196 +    '[subject]=3D"not-four"'\r
197 +add_message '[in-reply-to]=3D"<baz@four.com>"' \\r
198 +    '[references]=3D"<baz@four.com> <foo@four.com>"' \\r
199 +    '[subject]=3D"neither"'\r
200 +output=3D$(notmuch show --format=3Djson 'subject:four')\r
201 +test_expect_equal "$output" '[[[{"id": "foo@four.com", "match": true, "exc=\r
202 luded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/src=\r
203 /notmuch/test/tmp.thread-replies/mail/msg-007", "timestamp": 978709437, "da=\r
204 te_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subje=\r
205 ct": "four", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To=\r
206 ": "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Jan =\r
207 2001 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "co=\r
208 ntent": "This is just a test message (#7)\n"}]}, [[{"id": "msg-009@notmuch-=\r
209 test-suite", "match": false, "excluded": false, "filename": "/home/aecay/de=\r
210 velopment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-=\r
211 009", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbo=\r
212 x", "unread"], "headers": {"Subject": "neither", "From": "Notmuch Test Suit=\r
213 e <test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notm=\r
214 uchmail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": =\r
215 1, "content-type": "text/plain", "content": "This is just a test message (#=\r
216 9)\n"}]}, []]]]], [[{"id": "bar@four.com", "match": true, "excluded": false=\r
217 , "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test=\r
218 /tmp.thread-replies/mail/msg-008", "timestamp": 978709437, "date_relative":=\r
219  "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "not-fou=\r
220 r", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To": "Notmu=\r
221 ch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Jan 2001 15:4=\r
222 3:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "=\r
223 This is just a test message (#8)\n"}]}, []]]]'\r
224 +\r
225 +\r
226 +test_done\r
227 --=20\r
228 1.8.1.5\r
229 \r
230 \r
231 --=-=-=\r
232 Content-Type: text/x-patch\r
233 Content-Disposition: inline;\r
234  filename=0002-lib-database.cc-change-how-the-parent-of-a-message-i.patch\r
235 Content-Transfer-Encoding: quoted-printable\r
236 \r
237 >From 57739b9722a86ba50ef97ad7d5d21b3e5bc1a977 Mon Sep 17 00:00:00 2001\r
238 From: Aaron Ecay <aaronecay@gmail.com>\r
239 Date: Mon, 25 Feb 2013 18:46:41 -0500\r
240 Subject: [PATCH 2/2] lib/database.cc: change how the parent of a message is\r
241  calculated\r
242 \r
243 Presently, the code which finds the parent of a message as it is being\r
244 added to the database assumes that the first Message-ID-like substring\r
245 of the In-Reply-To header is the parent Message ID.  Some mail clients,\r
246 however, put stuff other than the Message-ID of the parent in the\r
247 In-Reply-To header, such as the email address of the sender of the\r
248 parent.  This can fool notmuch.\r
249 \r
250 The updated algorithm prefers the last Message ID in the References\r
251 header.  The References header lists messages oldest-first, so the last\r
252 Message ID is the parent (RFC2822, p. 24).  The References header is\r
253 also less likely to be in a non-standard\r
254 syntax (http://cr.yp.to/immhf/thread.html,\r
255 http://www.jwz.org/doc/threading.html).  In case the References header\r
256 is not to be found, fall back to the old behavior.\r
257 \r
258 V2 of this patch, incorporating feedback from Jani and (indirectly)\r
259 Austin.\r
260 ---\r
261  lib/database.cc     | 48 +++++++++++++++++++++++++++++++++---------------\r
262  test/thread-replies |  4 ----\r
263  2 files changed, 33 insertions(+), 19 deletions(-)\r
264 \r
265 diff --git a/lib/database.cc b/lib/database.cc\r
266 index 91d4329..52ed618 100644\r
267 --- a/lib/database.cc\r
268 +++ b/lib/database.cc\r
269 @@ -501,8 +501,10 @@ _parse_message_id (void *ctx, const char *message_id, =\r
270 const char **next)\r
271   * 'message_id' in the result (to avoid mass confusion when a single\r
272   * message references itself cyclically---and yes, mail messages are\r
273   * not infrequent in the wild that do this---don't ask me why).\r
274 -*/\r
275 -static void\r
276 + *\r
277 + * Return the last reference parsed, if it is not equal to message_id.\r
278 + */\r
279 +static char *\r
280  parse_references (void *ctx,\r
281                   const char *message_id,\r
282                   GHashTable *hash,\r
283 @@ -511,7 +513,7 @@ parse_references (void *ctx,\r
284      char *ref;\r
285 =20\r
286      if (refs =3D=3D NULL || *refs =3D=3D '\0')\r
287 -       return;\r
288 +       return NULL;\r
289 =20\r
290      while (*refs) {\r
291         ref =3D _parse_message_id (ctx, refs, &refs);\r
292 @@ -519,6 +521,17 @@ parse_references (void *ctx,\r
293         if (ref && strcmp (ref, message_id))\r
294             g_hash_table_insert (hash, ref, NULL);\r
295      }\r
296 +\r
297 +    /* The return value of this function is used to add a parent\r
298 +     * reference to the database.  We should avoid making a message\r
299 +     * its own parent, thus the following check.\r
300 +     */\r
301 +\r
302 +    if (ref && strcmp(ref, message_id)) {\r
303 +       return ref;\r
304 +    } else {\r
305 +       return NULL;\r
306 +    }\r
307  }\r
308 =20\r
309  notmuch_status_t\r
310 @@ -1510,28 +1523,33 @@ _notmuch_database_link_message_to_parents (notmuch_=\r
311 database_t *notmuch,\r
312  {\r
313      GHashTable *parents =3D NULL;\r
314      const char *refs, *in_reply_to, *in_reply_to_message_id;\r
315 +    const char *last_ref_message_id, *this_message_id;\r
316      GList *l, *keys =3D NULL;\r
317      notmuch_status_t ret =3D NOTMUCH_STATUS_SUCCESS;\r
318 =20\r
319      parents =3D g_hash_table_new_full (g_str_hash, g_str_equal,\r
320                                      _my_talloc_free_for_g_hash, NULL);\r
321 +    this_message_id =3D notmuch_message_get_message_id (message);\r
322 =20\r
323      refs =3D notmuch_message_file_get_header (message_file, "references");\r
324 -    parse_references (message, notmuch_message_get_message_id (message),\r
325 -                     parents, refs);\r
326 +    last_ref_message_id =3D parse_references (message,\r
327 +                                           this_message_id,\r
328 +                                           parents, refs);\r
329 =20\r
330      in_reply_to =3D notmuch_message_file_get_header (message_file, "in-rep=\r
331 ly-to");\r
332 -    parse_references (message, notmuch_message_get_message_id (message),\r
333 -                     parents, in_reply_to);\r
334 -\r
335 -    /* Carefully avoid adding any self-referential in-reply-to term. */\r
336 -    in_reply_to_message_id =3D _parse_message_id (message, in_reply_to, NU=\r
337 LL);\r
338 -    if (in_reply_to_message_id &&\r
339 -       strcmp (in_reply_to_message_id,\r
340 -               notmuch_message_get_message_id (message)))\r
341 -    {\r
342 +    in_reply_to_message_id =3D parse_references (message,\r
343 +                                              this_message_id,\r
344 +                                              parents, in_reply_to);\r
345 +\r
346 +    /* For the parent of this message, use the last message ID of the\r
347 +     * References header, if available.  If not, fall back to the\r
348 +     * first message ID in the In-Reply-To header. */\r
349 +    if (last_ref_message_id) {\r
350 +        _notmuch_message_add_term (message, "replyto",\r
351 +                                   last_ref_message_id);\r
352 +    } else if (in_reply_to_message_id) {\r
353         _notmuch_message_add_term (message, "replyto",\r
354 -                            _parse_message_id (message, in_reply_to, NULL));\r
355 +                            in_reply_to_message_id);\r
356      }\r
357 =20\r
358      keys =3D g_hash_table_get_keys (parents);\r
359 diff --git a/test/thread-replies b/test/thread-replies\r
360 index fd11a09..6dc6143 100755\r
361 --- a/test/thread-replies\r
362 +++ b/test/thread-replies\r
363 @@ -11,7 +11,6 @@ constructed properly, even in the presence of non-RFC-com=\r
364 pliant headers'\r
365  . ./test-lib.sh\r
366 =20\r
367  test_begin_subtest "Use References when In-Reply-To is broken"\r
368 -test_subtest_known_broken\r
369  add_message '[id]=3D"foo@one.com"' \\r
370      '[subject]=3Done'\r
371  add_message '[in-reply-to]=3D"mumble"' \\r
372 @@ -21,7 +20,6 @@ output=3D$(notmuch show --format=3Djson 'subject:one')\r
373  test_expect_equal "$output" '[[[{"id": "foo@one.com", "match": true, "excl=\r
374 uded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/src/=\r
375 notmuch/test/tmp.thread-replies/mail/msg-001", "timestamp": 978709437, "dat=\r
376 e_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subjec=\r
377 t": "one", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To":=\r
378  "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Jan 20=\r
379 01 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "cont=\r
380 ent": "This is just a test message (#1)\n"}]}, [[{"id": "msg-002@notmuch-te=\r
381 st-suite", "match": true, "excluded": false, "filename": "/home/aecay/devel=\r
382 opment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-002=\r
383 ", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox",=\r
384  "unread"], "headers": {"Subject": "Re: one", "From": "Notmuch Test Suite <=\r
385 test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuch=\r
386 mail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, =\r
387 "content-type": "text/plain", "content": "This is just a test message (#2)\=\r
388 n"}]}, []]]]]]'\r
389 =20\r
390  test_begin_subtest "Prefer References to In-Reply-To"\r
391 -test_subtest_known_broken\r
392  add_message '[id]=3D"foo@two.com"' \\r
393      '[subject]=3Dtwo'\r
394  add_message '[in-reply-to]=3D"<bar@baz.com>"' \\r
395 @@ -31,7 +29,6 @@ output=3D$(notmuch show --format=3Djson 'subject:two')\r
396  test_expect_equal "$output" '[[[{"id": "foo@two.com", "match": true, "excl=\r
397 uded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/src/=\r
398 notmuch/test/tmp.thread-replies/mail/msg-003", "timestamp": 978709437, "dat=\r
399 e_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subjec=\r
400 t": "two", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To":=\r
401  "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Jan 20=\r
402 01 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "cont=\r
403 ent": "This is just a test message (#3)\n"}]}, [[{"id": "msg-004@notmuch-te=\r
404 st-suite", "match": true, "excluded": false, "filename": "/home/aecay/devel=\r
405 opment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-004=\r
406 ", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox",=\r
407  "unread"], "headers": {"Subject": "Re: two", "From": "Notmuch Test Suite <=\r
408 test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuch=\r
409 mail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, =\r
410 "content-type": "text/plain", "content": "This is just a test message (#4)\=\r
411 n"}]}, []]]]]]'\r
412 =20\r
413  test_begin_subtest "Use In-Reply-To when no References"\r
414 -test_subtest_known_broken\r
415  add_message '[id]=3D"foo@three.com"' \\r
416      '[subject]=3D"three"'\r
417  add_message '[in-reply-to]=3D"<foo@three.com>"' \\r
418 @@ -40,7 +37,6 @@ output=3D$(notmuch show --format=3Djson 'subject:three')\r
419  test_expect_equal "$output" '[[[{"id": "foo@three.com", "match": true, "ex=\r
420 cluded": false, "filename": "/home/aecay/development/notmuch/notmuch-git/sr=\r
421 c/notmuch/test/tmp.thread-replies/mail/msg-005", "timestamp": 978709437, "d=\r
422 ate_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subj=\r
423 ect": "three", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "=\r
424 To": "Notmuch Test Suite <test_suite@notmuchmail.org>", "Date": "Fri, 05 Ja=\r
425 n 2001 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "=\r
426 content": "This is just a test message (#5)\n"}]}, [[{"id": "msg-006@notmuc=\r
427 h-test-suite", "match": true, "excluded": false, "filename": "/home/aecay/d=\r
428 evelopment/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg=\r
429 -006", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inb=\r
430 ox", "unread"], "headers": {"Subject": "Re: three", "From": "Notmuch Test S=\r
431 uite <test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@n=\r
432 otmuchmail.org>", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id=\r
433 ": 1, "content-type": "text/plain", "content": "This is just a test message=\r
434  (#6)\n"}]}, []]]]]]'\r
435 =20\r
436  test_begin_subtest "Use last Reference"\r
437 -test_subtest_known_broken\r
438  add_message '[id]=3D"foo@four.com"' \\r
439      '[subject]=3D"four"'\r
440  add_message '[id]=3D"bar@four.com"' \\r
441 --=20\r
442 1.8.1.5\r
443 \r
444 \r
445 --=-=-=\r
446 Content-Type: text/plain\r
447 \r
448 \r
449 \r
450 -- \r
451 Aaron Ecay\r
452 \r
453 --=-=-=--\r