* bug: git grep -P and multiline mode
@ 2014-06-23 6:54 Noel Grandin
2014-06-23 17:42 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Noel Grandin @ 2014-06-23 6:54 UTC (permalink / raw)
To: git@vger.kernel.org
Hi
It looks like the perl regular expression multiline mode does not work with 'git grep'
for example, something like
git grep -P '(?s)foo.*?bar"
will not match a file in the repo where it has something like
foo
bar
ie. split across two lines
Regards, Noel Grandin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug: git grep -P and multiline mode
2014-06-23 6:54 bug: git grep -P and multiline mode Noel Grandin
@ 2014-06-23 17:42 ` Junio C Hamano
2014-06-24 7:34 ` Noel Grandin
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2014-06-23 17:42 UTC (permalink / raw)
To: Noel Grandin; +Cc: git@vger.kernel.org
Noel Grandin <noelgrandin@gmail.com> writes:
> It looks like the perl regular expression multiline mode does not work with 'git grep'
Yes, and deliberately so, to avoid having to think about things like
"how would a multi-line match interact with 'grep -n'?"
We behave as if we feed each line of the contents one line at a time
to the matching engine that is chosen by the -P/-E/-G/-F optoins, so
this limitation is unlikely to change.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug: git grep -P and multiline mode
2014-06-23 17:42 ` Junio C Hamano
@ 2014-06-24 7:34 ` Noel Grandin
0 siblings, 0 replies; 3+ messages in thread
From: Noel Grandin @ 2014-06-24 7:34 UTC (permalink / raw)
To: Junio C Hamano, Noel Grandin; +Cc: git@vger.kernel.org
On 2014-06-23 07:42 PM, Junio C Hamano wrote:
> Noel Grandin <noelgrandin@gmail.com> writes:
>
>> It looks like the perl regular expression multiline mode does not work with 'git grep'
> Yes, and deliberately so, to avoid having to think about things like
> "how would a multi-line match interact with 'grep -n'?"
>
>
Ah, that is a pity.
I find the multi-line mode very useful for finding code problems that span multiple lines.
I'm sure there are other options that conflict, and the solution is to normally write out some kind of informative error
message?
Anyhow, since I'm too busy working on LibreOffice right now to work up a patch for git, I'll stick to using
find | xargs grep
:-)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-24 7:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23 6:54 bug: git grep -P and multiline mode Noel Grandin
2014-06-23 17:42 ` Junio C Hamano
2014-06-24 7:34 ` Noel Grandin
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 NNTP newsgroup(s).