grep: use REG_STARTEND for all matching if available

Refactor REG_STARTEND handling inlook_ahead() into a new helper,
regmatch(), and use it for line matching, too.  This allows regex
matching beyond NUL characters if regexec() supports the flag.  NUL
characters themselves are not matched in any way, though.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2010-05-22 23:35:07 +02:00
committed by Junio C Hamano
parent 52d799a79f
commit f96e56733a
2 changed files with 24 additions and 10 deletions

View File

@ -59,4 +59,14 @@ test_expect_success 'git grep -Fi iLE a' '
git grep -Fi iLE a
'
# This test actually passes on platforms where regexec() supports the
# flag REG_STARTEND.
test_expect_failure 'git grep ile a' '
git grep ile a
'
test_expect_failure 'git grep .fi a' '
git grep .fi a
'
test_done