diff options
author | Austin Clements <amdragon@MIT.EDU> | 2012-11-25 00:25:45 -0500 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-11-26 22:17:20 -0400 |
commit | 7611a72be2cf6488c4d57ac0545469ff7ae89760 (patch) | |
tree | 721cc644a97fa0d6a3ced633ffdcfba8f28a5b04 /notmuch-new.c | |
parent | f5d65615bb1a9e34761674aa5432495579b0aeaf (diff) |
new: Skip ignored broken symlinks
We now test for user ignore patterns before attempting to determine if
a directory entry is itself a directory. As a result, we no longer
abort for broken symlinks if the user has explicitly ignored them.
This fixes the test added in the previous patch. It also slightly
changes the debug output checked by another test of ignores.
Diffstat (limited to 'notmuch-new.c')
-rw-r--r-- | notmuch-new.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/notmuch-new.c b/notmuch-new.c index 56c4a6fd..718a5387 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -350,6 +350,18 @@ add_files (notmuch_database_t *notmuch, entry = fs_entries[i]; + /* Ignore any files/directories the user has configured to + * ignore. We do this before dirent_type both for performance + * and because we don't care if dirent_type fails on entries + * that are explicitly ignored. + */ + if (_entry_in_ignore_list (entry->d_name, state)) { + if (state->debug) + printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n", + path, entry->d_name); + continue; + } + /* We only want to descend into directories (and symlinks to * directories). */ entry_type = dirent_type (path, entry); @@ -364,22 +376,14 @@ add_files (notmuch_database_t *notmuch, } /* Ignore special directories to avoid infinite recursion. - * Also ignore the .notmuch directory, any "tmp" directory - * that appears within a maildir and files/directories - * the user has configured to be ignored. + * Also ignore the .notmuch directory and any "tmp" directory + * that appears within a maildir. */ if (strcmp (entry->d_name, ".") == 0 || strcmp (entry->d_name, "..") == 0 || (is_maildir && strcmp (entry->d_name, "tmp") == 0) || - 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); + strcmp (entry->d_name, ".notmuch") == 0) continue; - } next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name); status = add_files (notmuch, next, state); |