aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorMichał Kiedrowicz <michal.kiedrowicz@gmail.com>2011-05-09 23:52:05 +0200
committerJunio C Hamano <gitster@pobox.com>2011-05-09 16:29:33 -0700
commit63e7e9d8b6483fed555ebed1c79a4820b2ba2558 (patch)
tree6970e3b85e6870c8fc75eb5704e44c92b1872438 /builtin
parenta30c148aa7ec6583dbdb38fa6601df3cf4f5a660 (diff)
downloadgit-63e7e9d8b6483fed555ebed1c79a4820b2ba2558.tar.gz
git-63e7e9d8b6483fed555ebed1c79a4820b2ba2558.tar.xz
git-grep: Learn PCRE
This patch teaches git-grep the --perl-regexp/-P options (naming borrowed from GNU grep) in order to allow specifying PCRE regexes on the command line. PCRE has a number of features which make them more handy to use than POSIX regexes, like consistent escaping rules, extended character classes, ungreedy matching etc. git isn't build with PCRE support automatically. USE_LIBPCRE environment variable must be enabled (like `make USE_LIBPCRE=YesPlease`). Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/grep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 10a1f6531..683197510 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -781,6 +781,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
REG_EXTENDED),
OPT_BOOLEAN('F', "fixed-strings", &opt.fixed,
"interpret patterns as fixed strings"),
+ OPT_BOOLEAN('P', "perl-regexp", &opt.pcre,
+ "use Perl-compatible regular expressions"),
OPT_GROUP(""),
OPT_BOOLEAN('n', "line-number", &opt.linenum, "show line numbers"),
OPT_NEGBIT('h', NULL, &opt.pathname, "don't show filenames", 1),