From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id F111F6DE00B8 for ; Sat, 10 Jun 2017 13:02:51 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ljnk0h3ITEfS for ; Sat, 10 Jun 2017 13:02:51 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 2EF436DE00AC for ; Sat, 10 Jun 2017 13:02:50 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dJmXv-0000mU-8P; Sat, 10 Jun 2017 15:59:43 -0400 Received: (nullmailer pid 13576 invoked by uid 1000); Sat, 10 Jun 2017 20:02:46 -0000 From: David Bremner To: Daniel Kahn Gillmor , David Bremner , notmuch@freelists.org, notmuch@notmuchmail.org Subject: [PATCH] fixup! lib: index message files with duplicate message-ids Date: Sat, 10 Jun 2017 17:02:38 -0300 Message-Id: <20170610200238.13527-1-david@tethera.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <87k24rebkx.fsf@fifthhorseman.net> References: <87k24rebkx.fsf@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Sat, 10 Jun 2017 20:02:52 -0000 --- This seems to do the trick for preserving the subject as additional files are indexed. lib/add-message.cc | 3 ++- test/T670-duplicate-mid.sh | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/add-message.cc b/lib/add-message.cc index 26405742..711ed9fa 100644 --- a/lib/add-message.cc +++ b/lib/add-message.cc @@ -536,7 +536,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (ret) goto DONE; - _notmuch_message_set_header_values (message, date, from, subject); + if (is_new || is_ghost) + _notmuch_message_set_header_values (message, date, from, subject); ret = _notmuch_message_index_file (message, message_file); if (ret) diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh index da5ce5d4..ea5e1d6a 100755 --- a/test/T670-duplicate-mid.sh +++ b/test/T670-duplicate-mid.sh @@ -5,6 +5,13 @@ test_description="duplicate message ids" add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1' add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2' +test_begin_subtest 'First subject preserved' +cat < EXPECTED +thread:XXX 2001-01-05 [1/1(2)] Notmuch Test Suite; message 1 (inbox unread) +EOF +notmuch search id:duplicate | notmuch_search_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest 'Search for second subject' cat <EXPECTED MAIL_DIR/copy1 -- 2.11.0