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 moves a message between threads'
37 notmuch search --output=threads id:87iqd9rn3l.fsf@vertex.dottedmag > EXPECTED
39 sed -i 's/1258471718-6781-1-git-send-email-dottedmag@dottedmag.net/87iqd9rn3l.fsf@vertex.dottedmag/' $MAIL_DIR/02:2,*
40 notmuch reindex id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net
41 notmuch search --output=threads id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net > OUTPUT
42 test_expect_equal_file EXPECTED OUTPUT
44 test_begin_subtest 'reindex detects removal of all files'
45 notmuch search --output=messages not id:20091117232137.GA7669@griffis1.net> EXPECTED
47 mv $MAIL_DIR/cur/51:2,* duplicate-message-2.eml
48 notmuch reindex id:20091117232137.GA7669@griffis1.net
49 notmuch search --output=messages '*' > OUTPUT
50 test_expect_equal_file EXPECTED OUTPUT
52 test_begin_subtest "reindex preserves properties"
54 #= 1258471718-6781-1-git-send-email-dottedmag@dottedmag.net userprop=userval
55 #= 1258471718-6781-2-git-send-email-dottedmag@dottedmag.net userprop=userval
56 #= 1258491078-29658-1-git-send-email-dottedmag@dottedmag.net userprop=userval1
57 #= 20091117190054.GU3165@dottiness.seas.harvard.edu userprop=userval
58 #= 20091117203301.GV3165@dottiness.seas.harvard.edu userprop=userval3
59 #= 87fx8can9z.fsf@vertex.dottedmag userprop=userval2
60 #= 87iqd9rn3l.fsf@vertex.dottedmag userprop=userval
61 #= 87lji4lx9v.fsf@yoom.home.cworth.org userprop=userval3
62 #= 87lji5cbwo.fsf@yoom.home.cworth.org userprop=userval
63 #= cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com userprop=userval
65 notmuch restore < prop-dump
67 notmuch dump | grep '^#=' | sort > OUTPUT
68 test_expect_equal_file prop-dump OUTPUT
72 test_begin_subtest "reindex of lkml corpus preserves threads"
73 notmuch search '*' | notmuch_search_sanitize > EXPECTED
75 notmuch search '*' | notmuch_search_sanitize > OUTPUT
76 test_expect_equal_file EXPECTED OUTPUT