diff options
author | Michał Kiedrowicz <michal.kiedrowicz@gmail.com> | 2012-02-25 10:24:28 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-26 16:34:03 -0800 |
commit | fba4f1259db8e5dc47b1c8e6e344c61f7eb4a9df (patch) | |
tree | 29d7fee27130fd8acf264055f850ff4641e9a150 /server-info.c | |
parent | am: don't infloop for an empty input file (diff) | |
download | tgif-fba4f1259db8e5dc47b1c8e6e344c61f7eb4a9df.tar.xz |
grep -P: Fix matching ^ and $
When "git grep" is run with -P/--perl-regexp, it doesn't match ^ and $ at
the beginning/end of the line. This is because PCRE normally matches ^
and $ at the beginning/end of the whole text, not for each line, and "git
grep" passes a large chunk of text (possibly containing many lines) to
pcre_exec() and then splits the text into lines.
This makes "git grep -P" behave differently from "git grep -E" and also
from "grep -P" and "pcregrep":
$ cat file
a
b
$ git grep --no-index -P '^ ' file
$ git grep --no-index -E '^ ' file
file: b
$ grep -c -P '^ ' file
b
$ pcregrep -c '^ ' file
b
Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'server-info.c')
0 files changed, 0 insertions, 0 deletions