From 258a6188496fe5131203905b6cd596af69312247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kiedrowicz?= Date: Mon, 9 May 2011 23:52:08 +0200 Subject: git-grep: Bail out when -P is used with -F or -E MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes git-grep die() when -P is used on command line together with -E/--extended-regexp or -F/--fixed-strings. This also makes it bail out when grep.extendedRegexp is enabled. But `git grep -G -P pattern` and `git grep -E -G -P pattern` still work because -G and -E set opts.regflags during parse_options() and there is no way to detect `-G` or `-E -G`. Signed-off-by: MichaƂ Kiedrowicz Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index e845218f67..2a31eca5f2 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -637,4 +637,20 @@ test_expect_success LIBPCRE 'grep -P -w pattern' ' test_cmp expected actual ' +test_expect_success LIBPCRE 'grep -P -F returns error' ' + test_expect_code 128 git grep -P -F main +' + +test_expect_success LIBPCRE 'grep -P -E returns error' ' + test_expect_code 128 git grep -P -E main +' + +test_expect_failure LIBPCRE 'grep -P -G returns error' ' + test_expect_code 128 git grep -P -G main +' + +test_expect_failure LIBPCRE 'grep -P -E -G returns error' ' + test_expect_code 128 git grep -P -E -G main +' + test_done -- cgit v1.2.3