[PATCH 4/6] cli/new: ignore special directories also in pass 2

Subject: [PATCH 4/6] cli/new: ignore special directories also in pass 2

Date: Fri, 1 Sep 2017 18:53:09 +0300

To: notmuch@notmuchmail.org

Cc:

From: Jani Nikula


Avoid passing . and .. to ignore check. We also don't need to check
their dirent type either.
---
 notmuch-new.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/notmuch-new.c b/notmuch-new.c
index 378bf4c2a15a..2ce3af872f0e 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -521,6 +521,10 @@ add_files (notmuch_database_t *notmuch,
     for (i = 0; i < num_fs_entries && ! interrupted; i++) {
         entry = fs_entries[i];
 
+	/* Ignore special directories early. */
+	if (_special_directory (entry->d_name))
+	    continue;
+
 	/* Ignore files & directories user has configured to be ignored */
 	if (_entry_in_ignore_list (entry->d_name, state)) {
 	    if (state->debug)
-- 
2.11.0

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: