All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kiedrowicz <michal.kiedrowicz@gmail.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Martin Langhoff <martin.langhoff@gmail.com>
Subject: Re: [PATCH V2 4/5] git-grep: Learn PCRE
Date: Thu, 5 May 2011 09:41:47 +0200	[thread overview]
Message-ID: <20110505094147.22e3d158@mkiedrowicz> (raw)
In-Reply-To: <4DC2418E.4070006@viscovery.net>

On 05.05.2011 08:19:58 +0200 Johannes Sixt <j.sixt@viscovery.net> wrote:

> 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.

I took this from NO_CURL and NO_EXPAT descriptions:

	 Define NO_CURL if you do not have libcurl installed.
	 git-http-pull and git-http-push are not built, and you
	 cannot use http:// and https:// transports.

	Define NO_EXPAT if you do not have expat installed.
	git-http-push is not built, and you cannot push using
	http:// and https:// transports.

But I can reword it :).

> 
> > +#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");

I can argue. My message says why they aren't available, while your
proposition leaves Joe without a clue :). But I'm not that much attached
to it, I can change it.

> 
> 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.
> 

I prefer to die() at lowest possible level in case someone wants to use
these functions in another way (e.g. from revision-walking code).

But I can abstract these calls to die_pcre_not_supported() to not
repeat die() message.

> > +}
> > +
> > +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

Thanks for comments :)

  reply	other threads:[~2011-05-05  7:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 22:00 [PATCH V2 0/5] Add PCRE support to git-grep Michał Kiedrowicz
2011-05-04 22:00 ` [PATCH V2 1/5] Documentation: Add --line-number to git-grep synopsis Michał Kiedrowicz
2011-05-04 22:00 ` [PATCH V2 2/5] contrib/completion: --line-number to git grep Michał Kiedrowicz
2011-05-04 22:00 ` [PATCH V2 3/5] grep: Put calls to fixmatch() and regmatch() into patmatch() Michał Kiedrowicz
2011-05-04 22:00 ` [PATCH V2 4/5] git-grep: Learn PCRE Michał Kiedrowicz
2011-05-05  1:09   ` Junio C Hamano
2011-05-05  5:47     ` Bert Wesarg
2011-05-05 16:55       ` Junio C Hamano
2011-05-05  6:19   ` Johannes Sixt
2011-05-05  7:41     ` Michal Kiedrowicz [this message]
2011-05-05  7:49       ` Johannes Sixt
2011-05-05  8:38         ` Michal Kiedrowicz
2011-05-05  6:28   ` Johannes Sixt
2011-05-05  7:43     ` Michal Kiedrowicz
2011-05-05  7:43   ` Alex Riesen
2011-05-04 22:00 ` [PATCH V2 5/5] configure: Check for libpcre Michał Kiedrowicz

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110505094147.22e3d158@mkiedrowicz \
    --to=michal.kiedrowicz@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=martin.langhoff@gmail.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.