[RFC 3/5] cli: support shell globbing patterns in new.ignore

David Bremner david at tethera.net
Sat Mar 11 06:35:54 PST 2017


Jani Nikula <jani at nikula.org> writes:

> Keep the existing strcmp on the basename for backwards compatibility,
> and additionally use the new.ignore entries as fnmatch(3) patterns on
> the absolute filename. Note that it's not enough to add e.g. "foo*bar"
> to the list; you will need to do "*/foo*bar" to match the path also.

Are there (many?) fnmatch patterns that don't match themselves? I'm just
wondering if the extra strcmp is worth-it / needed?

>  
>  typedef struct _filename_node {
>      char *filename;
> @@ -236,15 +237,31 @@ _entries_resemble_maildir (const char *path, struct dirent **entries, int count)
>  /* Test if the file/directory is to be ignored.
>   */
>  static notmuch_bool_t
> -_entry_in_ignore_list (const char *entry, add_files_state_t *state)
> +_entry_in_ignore_list (const char *path, const char *entry,
> +		       add_files_state_t *state)
>  {

I was a bit confused when reading this (until I saw the calling
context). I guess path is dirname and entry is basename?

Other than needing doc and a test, I don't remember any objections to
this code, although I vaguely remember some alternative proposals for
ignoring?

I guess one point is that we are proposing to use regexps against paths
in one place [1] and proposing to use fnmatch here.  I'm not sure it's
worth trying to be more consistent, but now seems to be the time to
discuss. I think both places could use either, if someone did the
work. Of course the other argument is that the queries should be
consistent among themselves.

[1]: id:20170308024035.6149-1-david at tethera.net


More information about the notmuch mailing list