From: David Bremner <david@tethera.net>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH 5/6] cli/new: support /<regex>/ in new.ignore
Date: Mon, 25 Sep 2017 23:13:27 -0300 [thread overview]
Message-ID: <87zi9i437c.fsf@tethera.net> (raw)
In-Reply-To: <5e252ac400993a2fecdbe8c0d739aa4d23d3de72.1504280923.git.jani@nikula.org>
Jani Nikula <jani@nikula.org> writes:
> + A regular expression delimited with // that will be matched
> + against the path of the file or directory relative to the
> + database path. The beginning and end of string must be
> + explictly anchored. For example, /.*/foo$/ would match
> + "bar/foo" and "bar/baz/foo", but not "foo" or "bar/foobar".
Is it worth remarking that '/' does not need to be escaped? or more
interestingly, what happens if it is escaped, do things break?
>
> +static notmuch_bool_t
> +_setup_ignore (notmuch_config_t *config, add_files_state_t *state)
> +{
Would be nice to document what this return value means.
> + const char **ignore_list, **ignore;
> + int nregex = 0, nverbatim = 0;
> + const char **verbatim = NULL;
> + regex_t *regex = NULL;
> +
> + ignore_list = notmuch_config_get_new_ignore (config, NULL);
> + if (! ignore_list)
> + return TRUE;
> +
> + for (ignore = ignore_list; *ignore; ignore++) {
> + const char *s = *ignore;
> + size_t len = strlen (s);
> +
> + if (len > 2 && s[0] == '/' && s[len - 1] == '/') {
One thing we eventually settled on in the query parser is that an
opening '/' without a trailing '/' is an errror. But perhaps it's fine
to take a more permissive approach here.
> +
> + if (! state->ignore_regex_length)
> + return FALSE;
It's a nitpick, even by the standards of this review, but I'd prefer an
explicit '> 0' check.
next prev parent reply other threads:[~2017-09-26 2:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-01 15:53 [PATCH 0/6] cli: support regex in new.ignore Jani Nikula
2017-09-01 15:53 ` [PATCH 1/6] cli/new: use the same style for fs entry loops Jani Nikula
2017-09-13 12:08 ` David Bremner
2017-09-01 15:53 ` [PATCH 2/6] cli/new: abstract special directory check Jani Nikula
2017-09-01 15:53 ` [PATCH 3/6] cli/new: check for special directories earlier in pass 1 Jani Nikula
2017-10-02 11:05 ` David Bremner
2017-09-01 15:53 ` [PATCH 4/6] cli/new: ignore special directories also in pass 2 Jani Nikula
2017-09-01 15:53 ` [PATCH 5/6] cli/new: support /<regex>/ in new.ignore Jani Nikula
2017-09-26 2:13 ` David Bremner [this message]
2017-09-26 19:11 ` Jani Nikula
2017-10-02 1:00 ` David Bremner
2017-09-01 15:53 ` [PATCH 6/6] test: test regexp based new.ignore Jani Nikula
2017-10-02 0:57 ` David Bremner
2017-10-02 8:56 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zi9i437c.fsf@tethera.net \
--to=david@tethera.net \
--cc=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).