]> git.notmuchmail.org Git - notmuch/commit
notmuch new: Fix bug resulting in file removal on initial build of database.
authorCarl Worth <cworth@cworth.org>
Wed, 6 Jan 2010 21:54:39 +0000 (13:54 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 6 Jan 2010 21:54:39 +0000 (13:54 -0800)
commit7d8271dd9db5affa9fce589424d6f3b4d8b66cd7
tree00f1f35c75be6886385bc0b2b744402e4a163e7b
parent59c09623c844f095c14400a9b4199be20e5d712e
notmuch new: Fix bug resulting in file removal on initial build of database.

The bug here was that we would see that the database did not know
anything about a directory so would get results from the filesystem in
inode rather than strcmp order.

However, we wouldn't actually ask for the list of files from the
database until after recursing into the sub-directories. So by the
time we traverse the filenames looking for deletions, the database
*does* have entries and we end up detecting erroneous deletions
because our filename list from the filesystem isn't in strcmp order.

So ask for the list of names from the database before doing any
additions to avoid this problem.
notmuch-new.c