Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AF4D1431FDF for ; Thu, 23 Oct 2014 05:30:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fhzgoL60PYuP for ; Thu, 23 Oct 2014 05:30:48 -0700 (PDT) Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu [18.7.68.36]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 13E9D431FD4 for ; Thu, 23 Oct 2014 05:30:48 -0700 (PDT) X-AuditID: 12074424-f79346d000004923-fa-5448f4f75e6d Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id A6.1C.18723.7F4F8445; Thu, 23 Oct 2014 08:30:47 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s9NCUk9Q001784; Thu, 23 Oct 2014 08:30:47 -0400 Received: from drake.dyndns.org (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [216.15.114.40]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s9NCUh6H008924 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 23 Oct 2014 08:30:46 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.84) (envelope-from ) id 1XhHXP-0007bZ-3z; Thu, 23 Oct 2014 08:30:43 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v3 0/9] Add ghost messages and fix thread linking Date: Thu, 23 Oct 2014 08:30:32 -0400 Message-Id: <1414067441-29054-1-git-send-email-aclements@csail.mit.edu> X-Mailer: git-send-email 2.1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsUixCmqrfv9i0eIwbkN0har5/JYXL85k9mB yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgymi7s52p4I9QxZEj11gaGBfxdzFyckgImEjM Ov6GCcIWk7hwbz1bFyMXh5DAbCaJ6S97mSGcjYwSb9+cZYVw7jBJLL40mx3CWcIosfvsSkaQ fjYBfYkVayexgtgiAtISO+/OBrOZBWQlfpz/A2YLCzhK7NuyBWwfi4CqxPIHHWwgNq+Au0Tr 3WWsEHfISWzY/Z9xAiPvAkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRbrmermZJXqpKaWbGEGh we6isoOx+ZDSIUYBDkYlHt6KZI8QIdbEsuLK3EOMkhxMSqK8MQ+AQnxJ+SmVGYnFGfFFpTmp xYcYJTiYlUR44y8A5XhTEiurUovyYVLSHCxK4rybfvCFCAmkJ5akZqemFqQWwWRlODiUJHgZ gTEgJFiUmp5akZaZU4KQZuLgBBnOAzT81meQ4cUFibnFmekQ+VOMilLivMkgCQGQREZpHlwv LHZfMYoDvSLMuwGkigcY93Ddr4AGM4FcvQFscEkiQkqqgTG+o0Uq/HfegmfuRecdopf9C7Xe seKludbtB3szb7gt/Htph9jNz05bJKqf3yzSNi9OKuZeaXH1g5h2pqxJUtCyCw9uBiVqMoSq qmxxvPVl9ecjU+fermgO7Op6tadgp5/AhZ+bMnVrjWWi9ZQ8Pn5vnZtiG2OYnb/stLLu8YzS PuWAgJfJ5kosxRmJhlrMRcWJAANIyJC4AgAA X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 12:30:55 -0000 This is v3 of id:1412637438-4821-1-git-send-email-aclements@csail.mit.edu. This fixes some comments, as suggested by Mark. There are no code changes relative to v2. The diff from v2 is below. diff --git a/lib/database.cc b/lib/database.cc index 6e51a72..3601f9d 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -2121,10 +2121,13 @@ _consume_metadata_thread_id (void *ctx, notmuch_database_t *notmuch, /* Given a blank or ghost 'message' and its corresponding * 'message_file' link it to existing threads in the database. * - * The first check is in the metadata of the database to see if we - * have pre-allocated a thread_id in advance for this message, (which - * would have happened if a message was previously added that - * referenced this one). + * First, if is_ghost, this retrieves the thread ID already stored in + * the message (which will be the case if a message was previously + * added that referenced this one). If the message is blank + * (!is_ghost), it doesn't have a thread ID yet (we'll generate one + * later in this function). If the database does not support ghost + * messages, this checks for a thread ID stored in database metadata + * for this message ID. * * Second, we look at 'message_file' and its link-relevant headers * (References and In-Reply-To) for message IDs. @@ -2132,12 +2135,12 @@ _consume_metadata_thread_id (void *ctx, notmuch_database_t *notmuch, * Finally, we look in the database for existing message that * reference 'message'. * - * In all cases, we assign to the current message the first thread_id - * found (through either parent or child). We will also merge any - * existing, distinct threads where this message belongs to both, - * (which is not uncommon when messages are processed out of order). + * In all cases, we assign to the current message the first thread ID + * found. We will also merge any existing, distinct threads where this + * message belongs to both, (which is not uncommon when messages are + * processed out of order). * - * Finally, if no thread ID has been found through parent or child, we + * Finally, if no thread ID has been found through referenced messages, we * call _notmuch_message_generate_thread_id to generate a new thread * ID. This should only happen for new, top-level messages, (no * References or In-Reply-To header in this message, and no previously