[PATCH] fixup! lib: index message files with duplicate message-ids
David Bremner
david at tethera.net
Sat Jun 10 13:02:38 PDT 2017
---
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 <<EOF > 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 <<EOF >EXPECTED
MAIL_DIR/copy1
--
2.11.0
More information about the notmuch
mailing list