2 test_description="duplicate message ids"
3 . ./test-lib.sh || exit 1
5 add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1'
6 add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2'
8 add_message '[id]="duplicate"' '[subject]="message 0" [filename]=copy0'
9 test_begin_subtest 'search: first indexed subject preserved'
11 thread:XXX 2001-01-05 [1/1(3)] Notmuch Test Suite; message 1 (inbox unread)
13 notmuch search id:duplicate | notmuch_search_sanitize > OUTPUT
14 test_expect_equal_file EXPECTED OUTPUT
16 test_begin_subtest 'Search for second subject'
22 notmuch search --output=files subject:'"message 2"' | notmuch_dir_sanitize > OUTPUT
23 test_expect_equal_file EXPECTED OUTPUT
25 add_message '[id]="duplicate"' '[body]="sekrit" [filename]=copy3'
26 test_begin_subtest 'search for body in duplicate file'
33 notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT
34 test_expect_equal_file EXPECTED OUTPUT
37 test_begin_subtest 'reindex drops terms in duplicate file'
40 notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT
41 test_expect_equal_file EXPECTED OUTPUT
44 test_begin_subtest 'Deleted first duplicate file does not stop notmuch show from working'
45 output=$(notmuch show --body=false --format=json id:duplicate |
46 notmuch_json_show_sanitize | sed 's/message [0-9]/A_SUBJECT/')
52 "'"${MAIL_DIR}"/copy0'",
53 "'"${MAIL_DIR}"/copy1'",
54 "'"${MAIL_DIR}"/copy2'"
57 "date_relative": "2001-01-05",
58 "tags": ["inbox","unread"],
60 "Subject": "A_SUBJECT",
61 "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
62 "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
63 "Date": "GENERATED_DATE"
68 test_expect_equal_json "$output" "$expected"