--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 CEBCB431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Oct 2014 16:17:34 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 oZpYtTZUOGog for <notmuch@notmuchmail.org>;\r
+ Tue, 21 Oct 2014 16:17:26 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id BABC1431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Oct 2014 16:17:26 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Xgig6-0006iN-Q7; Wed, 22 Oct 2014 00:17:24 +0100\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Xgig6-0003bG-40; Wed, 22 Oct 2014 00:17:22 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Austin Clements <aclements@csail.mit.edu>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 12/12] lib: Remove unnecessary thread linking steps\r
+ when using ghost messages\r
+In-Reply-To: <1412637438-4821-13-git-send-email-aclements@csail.mit.edu>\r
+References: <1412637438-4821-1-git-send-email-aclements@csail.mit.edu>\r
+ <1412637438-4821-13-git-send-email-aclements@csail.mit.edu>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Wed, 22 Oct 2014 00:17:20 +0100\r
+Message-ID: <87wq7thv27.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 8f205de2c1ce8354d0314db30b07b78c (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Tue, 21 Oct 2014 23:17:35 -0000\r
+\r
+On Tue, 07 Oct 2014, Austin Clements <aclements@csail.mit.edu> wrote:\r
+> From: Austin Clements <amdragon@mit.edu>\r
+>\r
+> Previously, it was necessary to link new messages to children to work\r
+> around some (though not all) problems with the old metadata-based\r
+> approach to stored thread IDs. With ghost messages, this is no longer\r
+> necessary, so don't bother with child linking when ghost messages are\r
+> in use.\r
+> ---\r
+> lib/database.cc | 21 +++++++++++++++++----\r
+> 1 file changed, 17 insertions(+), 4 deletions(-)\r
+>\r
+> diff --git a/lib/database.cc b/lib/database.cc\r
+> index 1316529..6e51a72 100644\r
+> --- a/lib/database.cc\r
+> +++ b/lib/database.cc\r
+> @@ -2169,10 +2169,23 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,\r
+> if (status)\r
+> goto DONE;\r
+> \r
+> - status = _notmuch_database_link_message_to_children (notmuch, message,\r
+> - &thread_id);\r
+> - if (status)\r
+> - goto DONE;\r
+> + if (! (notmuch->features & NOTMUCH_FEATURE_GHOSTS)) {\r
+> + /* In general, it shouldn't be necessary to link children,\r
+> + * since the earlier indexing of those children will have\r
+> + * stored a thread ID for the missing parent. However, prior\r
+> + * to ghost messages, these stored thread IDs were NOT\r
+> + * rewritten during thread merging (and there was no\r
+> + * performant way to do so), so if indexed children were\r
+> + * pulled into a different thread ID by a merge, it was\r
+> + * necessary to pull them *back* into the stored thread ID of\r
+> + * the parent. With ghost messages, we just rewrite the\r
+> + * stored thread IDs during merging, so this workaround isn't\r
+> + * necessary. */\r
+> + status = _notmuch_database_link_message_to_children (notmuch, message,\r
+> + &thread_id);\r
+> + if (status)\r
+> + goto DONE;\r
+> + }\r
+\r
+Ok so this basically answers my earlier comment. It might be worth\r
+updating the big comment at the start of the function to match the new\r
+code though.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+> \r
+> /* If not part of any existing thread, generate a new thread ID. */\r
+> if (thread_id == NULL) {\r
+> -- \r
+> 2.1.0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r