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

Jani Nikula jani at nikula.org
Fri Sep 1 08:53:09 PDT 2017


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



More information about the notmuch mailing list