--- /dev/null
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id D46BA6DE02DD\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Apr 2016 07:15:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.732\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.732 tagged_above=-999 required=5\r
+ tests=[AWL=-0.732] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id z9Rk9reRS0wE for <notmuch@notmuchmail.org>;\r
+ Sat, 2 Apr 2016 07:15:47 -0700 (PDT)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id B818C6DE02C2\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Apr 2016 07:15:47 -0700 (PDT)\r
+Received: from fifthhorseman.net (dhcp-a244.meeting.ietf.org [31.133.162.68])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 81238F99A\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Apr 2016 10:15:45 -0400 (EDT)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id A4F441FD2C; Sat, 2 Apr 2016 11:15:41 -0300 (BRT)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v2 2/7] verify during thread-breakage that messages are\r
+ removed as well\r
+Date: Sat, 2 Apr 2016 11:15:36 -0300\r
+Message-Id: <1459606541-23889-2-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.8.0.rc3\r
+In-Reply-To: <1459606541-23889-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1459606541-23889-1-git-send-email-dkg@fifthhorseman.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 02 Apr 2016 14:15:55 -0000\r
+\r
+One risk of fixes to the thread-breakage problem is that we could fail\r
+to remove the search term indexes entirely. These additional subtests\r
+should guard against that.\r
+---\r
+ test/T590-thread-breakage.sh | 17 +++++++++++++++++\r
+ 1 file changed, 17 insertions(+)\r
+\r
+diff --git a/test/T590-thread-breakage.sh b/test/T590-thread-breakage.sh\r
+index 704f504..f3e725c 100755\r
+--- a/test/T590-thread-breakage.sh\r
++++ b/test/T590-thread-breakage.sh\r
+@@ -17,6 +17,7 @@ To: Bob <bob@example.net>\r
+ Date: Thu, 31 Mar 2016 20:10:00 -0400\r
+ \r
+ This is the first message in the thread.\r
++Apple\r
+ EOF\r
+ }\r
+ \r
+@@ -32,10 +33,18 @@ To: Alice <alice@example.net>\r
+ Date: Thu, 31 Mar 2016 20:15:00 -0400\r
+ \r
+ This is the second message in the thread.\r
++Banana\r
+ EOF\r
+ }\r
+ \r
+ \r
++test_subject_count() {\r
++ notmuch new >/dev/null\r
++ test_begin_subtest "${3:-looking for $2 instance of '$1'}"\r
++ count=$(notmuch count --output=threads "$1")\r
++ test_expect_equal "$count" "$2"\r
++}\r
++\r
+ test_thread_count() {\r
+ notmuch new >/dev/null\r
+ test_begin_subtest "${2:-Expecting $1 thread(s)}"\r
+@@ -47,17 +56,25 @@ test_thread_count 0 'There should be no threads initially'\r
+ \r
+ message_a\r
+ test_thread_count 1 'One message in: one thread'\r
++test_subject_count apple 1\r
++test_subject_count banana 0\r
+ \r
+ message_b\r
+ test_thread_count 1 'Second message in the same thread: one thread'\r
++test_subject_count apple 1\r
++test_subject_count banana 1\r
+ \r
+ rm -f ${MAIL_DIR}/cur/a\r
+ test_thread_count 1 'First message removed: still only one thread'\r
++test_subject_count apple 0\r
++test_subject_count banana 1\r
+ \r
+ message_a\r
+ # this is known to fail (it shows 2 threads) because no "ghost\r
+ # message" was created for message A when it was removed from the\r
+ # index, despite message B still pointing to it.\r
+ test_thread_count 1 'First message reappears: should return to the same thread'\r
++test_subject_count apple 1\r
++test_subject_count banana 1\r
+ \r
+ test_done\r
+-- \r
+2.8.0.rc3\r
+\r