X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-new.c;h=31d45532aa0494934ec545c77ff40130bc27b007;hp=941f9d615a44ce07521395db331a9c6b7d11b6c4;hb=b0006b6ea2357572637b0c7946dfd074cfe18178;hpb=2d6718b837b11b48d6b6ce1ae3f863591d5b651a diff --git a/notmuch-new.c b/notmuch-new.c index 941f9d61..31d45532 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -247,15 +247,7 @@ add_files_recursive (notmuch_database_t *notmuch, directory = notmuch_database_get_directory (notmuch, path); db_mtime = notmuch_directory_get_mtime (directory); - if (db_mtime == 0) { - new_directory = TRUE; - db_files = NULL; - db_subdirs = NULL; - } else { - new_directory = FALSE; - db_files = notmuch_directory_get_child_files (directory); - db_subdirs = notmuch_directory_get_child_directories (directory); - } + new_directory = db_mtime ? FALSE : TRUE; /* If the database knows about this directory, then we sort based * on strcmp to match the database sorting. Otherwise, we can do @@ -328,6 +320,11 @@ add_files_recursive (notmuch_database_t *notmuch, if (fs_mtime == db_mtime) goto DONE; + if (!new_directory) { + db_files = notmuch_directory_get_child_files (directory); + db_subdirs = notmuch_directory_get_child_directories (directory); + } + /* Pass 2: Scan for new files, removed files, and removed directories. */ for (i = 0; i < num_fs_entries; i++) {