cli: don't call _entry_in_ignore_list twice in count files debug
authorJani Nikula <jani@nikula.org>
Sat, 17 Dec 2016 16:28:43 +0000 (18:28 +0200)
committerDavid Bremner <david@tethera.net>
Sat, 28 Jan 2017 02:05:05 +0000 (22:05 -0400)
Split file ignores in count_files to fixed and user configured in
order to not have to call _entry_in_ignore_list twice when debugging
is enabled. Minor detail.

notmuch-new.c

index cc680b412a45e023e1b1b6cec0b92d37cf8c774c..13212639cc8ec669df4ea3d47f6c0d4d9a3fd834 100644 (file)
@@ -738,18 +738,20 @@ count_files (const char *path, int *count, add_files_state_t *state)
         entry = fs_entries[i];
 
        /* Ignore special directories to avoid infinite recursion.
-        * Also ignore the .notmuch directory and files/directories
-        * the user has configured to be ignored.
+        * Also ignore the .notmuch directory.
         */
        if (strcmp (entry->d_name, ".") == 0 ||
            strcmp (entry->d_name, "..") == 0 ||
-           strcmp (entry->d_name, ".notmuch") == 0 ||
-           _entry_in_ignore_list (entry->d_name, state))
-       {
-           if (state->debug && _entry_in_ignore_list (entry->d_name, state))
+           strcmp (entry->d_name, ".notmuch") == 0)
+           continue;
+
+       /* Ignore any files/directories the user has configured to be
+        * ignored
+        */
+       if (_entry_in_ignore_list (entry->d_name, state)) {
+           if (state->debug)
                printf ("(D) count_files: explicitly ignoring %s/%s\n",
-                       path,
-                       entry->d_name);
+                       path, entry->d_name);
            continue;
        }