2 test_description='reindexing messages'
3 . $(dirname "$0")/test-lib.sh || exit 1
7 notmuch tag +usertag1 '*'
9 notmuch search '*' | notmuch_search_sanitize > initial-threads
10 notmuch search --output=messages '*' > initial-message-ids
11 notmuch dump > initial-dump
13 test_begin_subtest 'reindex preserves threads'
15 notmuch search '*' | notmuch_search_sanitize > OUTPUT
16 test_expect_equal_file initial-threads OUTPUT
18 test_begin_subtest 'reindex after removing duplicate file preserves threads'
20 sed 's,3/3(4),3/3,' < initial-threads > EXPECTED
21 mv $MAIL_DIR/bar/18:2, duplicate-msg-1.eml
23 notmuch search '*' | notmuch_search_sanitize > OUTPUT
24 test_expect_equal_file EXPECTED OUTPUT
26 test_begin_subtest 'reindex preserves message-ids'
28 notmuch search --output=messages '*' > OUTPUT
29 test_expect_equal_file initial-message-ids OUTPUT
31 test_begin_subtest 'reindex preserves tags'
34 test_expect_equal_file initial-dump OUTPUT
36 test_begin_subtest 'reindex preserves tags with special prefixes'
37 notmuch tag +attachment2 +encrypted2 +signed2 '*'
38 notmuch dump > EXPECTED
41 notmuch tag -attachment2 -encrypted2 -signed2 '*'
42 test_expect_equal_file EXPECTED OUTPUT
44 test_begin_subtest 'reindex moves a message between threads'
45 notmuch search --output=threads id:87iqd9rn3l.fsf@vertex.dottedmag > EXPECTED
47 sed -i 's/1258471718-6781-1-git-send-email-dottedmag@dottedmag.net/87iqd9rn3l.fsf@vertex.dottedmag/' $MAIL_DIR/02:2,*
48 notmuch reindex id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net
49 notmuch search --output=threads id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net > OUTPUT
50 test_expect_equal_file EXPECTED OUTPUT
52 test_begin_subtest 'reindex detects removal of all files'
53 notmuch search --output=messages not id:20091117232137.GA7669@griffis1.net> EXPECTED
55 mv $MAIL_DIR/cur/51:2,* duplicate-message-2.eml
56 notmuch reindex id:20091117232137.GA7669@griffis1.net
57 notmuch search --output=messages '*' > OUTPUT
58 test_expect_equal_file EXPECTED OUTPUT
60 test_begin_subtest "reindex preserves properties"
62 #= 1258471718-6781-1-git-send-email-dottedmag@dottedmag.net userprop=userval
63 #= 1258471718-6781-2-git-send-email-dottedmag@dottedmag.net userprop=userval
64 #= 1258491078-29658-1-git-send-email-dottedmag@dottedmag.net userprop=userval1
65 #= 20091117190054.GU3165@dottiness.seas.harvard.edu userprop=userval
66 #= 20091117203301.GV3165@dottiness.seas.harvard.edu userprop=userval3
67 #= 87fx8can9z.fsf@vertex.dottedmag userprop=userval2
68 #= 87iqd9rn3l.fsf@vertex.dottedmag userprop=userval
69 #= 87lji4lx9v.fsf@yoom.home.cworth.org userprop=userval3
70 #= 87lji5cbwo.fsf@yoom.home.cworth.org userprop=userval
71 #= cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com userprop=userval
73 notmuch restore < prop-dump
75 notmuch dump | grep '^#=' | sort > OUTPUT
76 test_expect_equal_file prop-dump OUTPUT
80 test_begin_subtest "reindex of lkml corpus preserves threads"
81 notmuch search '*' | notmuch_search_sanitize > EXPECTED
83 notmuch search '*' | notmuch_search_sanitize > OUTPUT
84 test_expect_equal_file EXPECTED OUTPUT