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

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

Date: Sat, 11 Mar 2017 10:35:54 -0400

To: Jani Nikula,


From: David Bremner

Jani Nikula <> 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

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.