]> git.notmuchmail.org Git - notmuch/commit
insert: strip trailing / in folder path
authorYuri Volchkov <yuri.volchkov@gmail.com>
Mon, 21 Aug 2017 15:44:46 +0000 (17:44 +0200)
committerDavid Bremner <david@tethera.net>
Tue, 22 Aug 2017 21:48:09 +0000 (18:48 -0300)
commit33a170e1163b39b47deafcaef863d19c0d5d62cd
treeaafd44f9044347d97db33dd2a6ce4f4ecbaac132
parentcec4a87539599e7d253b694c2a0a81de86d6eb7e
insert: strip trailing / in folder path

This patch fixes the "Insert message into folder with trailing /"
test. The problem was insufficient path canonization.

From database's point of view, "Sent" and "Sent/" are different
folders. If user runs (note the last '/'):

    notmuch insert --folder=maildir/Sent/ < test.msg

notmuch will create an extra XDIRECTORY record for the folder
'Sent/'. This means that database will have _TWO_ records for _ONE_
physical folder: 'Sent' and 'Sent/'. However, the 'notmuch new'
command will update only records related to the first one (the correct
one).

Now, if user moved the email file (e.g. from 'Sent/new' to
'Sent/cur'), 'notmuch new' will add a record about the new file, but
will not delete the old record.

Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
notmuch-insert.c
test/T070-insert.sh