From 9d48ee2eaacce7323622e6017f7bdb01a915e885 Mon Sep 17 00:00:00 2001
From: Jani Nikula <jani@nikula.org>
Date: Fri, 1 Sep 2017 18:53:09 +0300
Subject: [PATCH] cli/new: ignore special directories also in pass 2

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 378bf4c2..2ce3af87 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.45.2