[PATCH 4/6] cli: notmuch new: optionally output debug information when ignoring files/directories

Pieter Praet pieter at praet.org
Sun Feb 19 12:47:54 PST 2012


When running 'notmuch new' with the '--debug' option, output debug
information regarding explicitly ignored files and directories.
---
 notmuch-new.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index ca12003..6f34da1 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -347,6 +347,10 @@ add_files_recursive (notmuch_database_t *notmuch,
 	    strcmp (entry->d_name, ".notmuch") == 0 ||
 	    _entry_in_ignore_list (entry->d_name, state))
 	{
+	    if (_entry_in_ignore_list (entry->d_name, state) && state->debug)
+		printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n",
+			path,
+			entry->d_name);
 	    continue;
 	}
 
@@ -387,8 +391,13 @@ add_files_recursive (notmuch_database_t *notmuch,
         entry = fs_entries[i];
 
 	/* Ignore files & directories user has configured to be ignored */
-	if (_entry_in_ignore_list (entry->d_name, state))
+	if (_entry_in_ignore_list (entry->d_name, state)) {
+	    if (state->debug)
+		printf ("(D) add_files_recursive, pass 2: explicitly ignoring %s/%s\n",
+			path,
+			entry->d_name);
 	    continue;
+	}
 
 	/* Check if we've walked past any names in db_files or
 	 * db_subdirs. If so, these have been deleted. */
@@ -701,6 +710,10 @@ count_files (const char *path, int *count, add_files_state_t *state)
 	    strcmp (entry->d_name, ".notmuch") == 0 ||
 	    _entry_in_ignore_list (entry->d_name, state))
 	{
+	    if (_entry_in_ignore_list (entry->d_name, state) && state->debug)
+		printf ("(D) count_files: explicitly ignoring %s/%s\n",
+			path,
+			entry->d_name);
 	    continue;
 	}
 
-- 
1.7.8.1



More information about the notmuch mailing list