]> git.notmuchmail.org Git - notmuch/commitdiff
cli/new: check for special directories earlier in pass 1
authorJani Nikula <jani@nikula.org>
Fri, 1 Sep 2017 15:53:08 +0000 (18:53 +0300)
committerDavid Bremner <david@tethera.net>
Mon, 2 Oct 2017 10:59:19 +0000 (07:59 -0300)
Avoid passing . and .. to ignore check. We don't need to check their
dirent type either.

notmuch-new.c

index faeb8f0a5896a4e23b012c2ba6c0be986b5a01b4..378bf4c2a15a7dd2a1215b77998d8f73daad1943 100644 (file)
@@ -452,6 +452,10 @@ add_files (notmuch_database_t *notmuch,
     for (i = 0; i < num_fs_entries && ! interrupted; i++) {
        entry = fs_entries[i];
 
+       /* Ignore special directories to avoid infinite recursion. */
+       if (_special_directory (entry->d_name))
+           continue;
+
        /* Ignore any files/directories the user has configured to
         * ignore.  We do this before dirent_type both for performance
         * and because we don't care if dirent_type fails on entries
@@ -477,12 +481,10 @@ add_files (notmuch_database_t *notmuch,
            continue;
        }
 
-       /* Ignore special directories to avoid infinite recursion.
-        * Also ignore the .notmuch directory and any "tmp" directory
+       /* Ignore the .notmuch directory and any "tmp" directory
         * that appears within a maildir.
         */
-       if (_special_directory (entry->d_name) ||
-           (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
+       if ((is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
            strcmp (entry->d_name, ".notmuch") == 0)
            continue;