Re: [PATCH V2 4/5] git-grep: Learn PCRE
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- May 5, 2011, 06:19 UTC
- Message-ID
- <4DC2418E.4070006@viscovery.net>
- In-Reply-To
- <1304546421-25439-5-git-send-email-michal.kiedrowicz@gmail.com>
Am 5/5/2011 0:00, schrieb Michał Kiedrowicz:
> +# Define NO_LIBPCRE if you do not have libpcre installed. git-grep cannot use > +# Perl-compatible regexes.
For what purpose are you adding Perl-regex when git-grep cannot use them?
...
Oh! You mean to say "..., but git-grep cannot use Perl-compatible regexes _in this case_".
;)
This repeats in patch 5/5.
> +#ifdef NO_LIBPCRE
> +static void compile_pcre_regexp(struct grep_pat *p, struct grep_opt *opt)
> +{
> + die("cannot use Perl-compatible regexes when libpcre is not compiled in");This is such a terminus technicus. Wouldn't it be much easier to read for Joe User if this were merely:
die("Perl-compatible regexes not supported");Also, wouldn't it be nicer to die already when the --perl-regexp option is detected? Then you could make these functions dummies that behave as if nothing was matched.
Show 12 quoted lines
> +}
> +
> +static int pcrematch(struct grep_pat *p, char *line, char *eol,
> + regmatch_t *match, int eflags)
> +{
> + die("cannot use Perl-compatible regexes when libpcre is not compiled in");
> +}
> +
> +static void free_pcre_regexp(struct grep_pat *p)
> +{
> + die("cannot use Perl-compatible regexes when libpcre is not compiled in");
> +}-- Hannes