]> git.notmuchmail.org Git - notmuch/commitdiff
Maildir synchronization
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 31 Oct 2010 21:29:16 +0000 (22:29 +0100)
committerCarl Worth <cworth@cworth.org>
Wed, 10 Nov 2010 21:09:31 +0000 (13:09 -0800)
This patch allows bi-directional synchronization between maildir
flags and certain tags. The flag-to-tag mapping is defined by flag2tag
array.

The synchronization works this way:

1) Whenever notmuch new is executed, the following happens:
   o New messages are tagged with configured new_tags.
   o For new or renamed messages with maildir info present in the file
     name, the tags defined in flag2tag are either added or removed
     depending on the flags from the file name.

2) Whenever notmuch tag (or notmuch restore) is executed, a new set of
   flags based on the tags is constructed for every message and a new
   file name is prepared based on the old file name but with the new
   flags. If the flags differs and the old message was in 'new'
   directory then this is replaced with 'cur' in the new file name. If
   the new and old file names differ, the file is renamed and notmuch
   database is updated accordingly.

   The rename happens before the database is updated. In case of crash
   between rename and database update, the next run of notmuch new
   brings the database in sync with the mail store again.


No differences found