1 Return-Path: <dkg@fifthhorseman.net>
\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 arlo.cworth.org (Postfix) with ESMTP id 39C3F6DE0360
\r
6 for <notmuch@notmuchmail.org>; Fri, 8 Apr 2016 18:03:02 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id tyJciQat_1Qy for <notmuch@notmuchmail.org>;
\r
16 Fri, 8 Apr 2016 18:02:54 -0700 (PDT)
\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id C9EFA6DE02D0
\r
19 for <notmuch@notmuchmail.org>; Fri, 8 Apr 2016 18:02:40 -0700 (PDT)
\r
20 Received: from fifthhorseman.net (unknown [201.140.212.132])
\r
21 by che.mayfirst.org (Postfix) with ESMTPSA id 5538C10080
\r
22 for <notmuch@notmuchmail.org>; Fri, 8 Apr 2016 21:02:39 -0400 (EDT)
\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)
\r
24 id 0E84B200E0; Fri, 8 Apr 2016 22:02:35 -0300 (ART)
\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
27 Subject: [PATCH v3 7/7] complete ghost-on-removal-when-shared-thread-exists
\r
28 Date: Fri, 8 Apr 2016 22:02:34 -0300
\r
29 Message-Id: <1460163754-22994-7-git-send-email-dkg@fifthhorseman.net>
\r
30 X-Mailer: git-send-email 2.8.0.rc3
\r
31 In-Reply-To: <1460163754-22994-1-git-send-email-dkg@fifthhorseman.net>
\r
32 References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net>
\r
33 <1460163754-22994-1-git-send-email-dkg@fifthhorseman.net>
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.20
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Sat, 09 Apr 2016 01:03:02 -0000
\r
48 To fully complete the ghost-on-removal-when-shared-thread-exists
\r
49 proposal, we need to clear all ghost messages when the last active
\r
50 message is removed from a thread.
\r
52 lib/message.cc | 20 ++++++++++++++++++++
\r
53 test/T590-thread-breakage.sh | 6 +-----
\r
54 2 files changed, 21 insertions(+), 5 deletions(-)
\r
56 diff --git a/lib/message.cc b/lib/message.cc
\r
57 index 1b423b0..39dbe53 100644
\r
58 --- a/lib/message.cc
\r
59 +++ b/lib/message.cc
\r
60 @@ -1098,6 +1098,26 @@ _notmuch_message_delete (notmuch_message_t *message)
\r
62 notmuch_message_destroy (ghost);
\r
63 status = COERCE_STATUS (private_status, "Error converting to ghost message");
\r
65 + /* the thread is empty; drop all ghost messages from it */
\r
66 + notmuch_messages_t *messages;
\r
67 + status = _notmuch_query_search_documents (query,
\r
70 + if (status == NOTMUCH_STATUS_SUCCESS) {
\r
71 + notmuch_status_t last_error = NOTMUCH_STATUS_SUCCESS;
\r
72 + while (notmuch_messages_valid (messages)) {
\r
73 + message = notmuch_messages_get (messages);
\r
74 + status = _notmuch_message_delete (message);
\r
75 + if (status) /* we'll report the last failure we see;
\r
76 + * if there is more than one failure, we
\r
77 + * forget about previous ones */
\r
78 + last_error = status;
\r
79 + notmuch_message_destroy (message);
\r
80 + notmuch_messages_move_to_next (messages);
\r
82 + status = last_error;
\r
85 notmuch_query_destroy (query);
\r
87 diff --git a/test/T590-thread-breakage.sh b/test/T590-thread-breakage.sh
\r
88 index 22e5cbc..969243e 100755
\r
89 --- a/test/T590-thread-breakage.sh
\r
90 +++ b/test/T590-thread-breakage.sh
\r
91 @@ -121,10 +121,6 @@ notmuch new >/dev/null
\r
92 test_thread_count 0 'All messages gone: no threads'
\r
93 test_subject_count apple 0
\r
94 test_subject_count banana 0
\r
95 -test_begin_subtest 'No ghosts should remain after full thread deletion'
\r
96 -# this is known to fail; we are leaking ghost messages deliberately
\r
97 -test_subtest_known_broken
\r
98 -ghosts=$(../ghost-report ${MAIL_DIR}/.notmuch/xapian)
\r
99 -test_expect_equal "$ghosts" "0"
\r
100 +test_ghost_count 0 'No ghosts should remain after full thread deletion'
\r