From 526a858a99ace6698823740374edc3e35b87901a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 20 May 2012 16:33:07 +0200 Subject: grep: support newline separated pattern list Currently, patterns that contain newline characters don't match anything when given to git grep. Regular grep(1) interprets patterns as lists of newline separated search strings instead. Implement this functionality by creating and inserting extra grep_pat structures for patterns consisting of multiple lines when appending to the pattern lists. For simplicity, all pattern strings are duplicated. The original pattern is truncated in place to make it contain only the first line. Requested-by: Torne (Richard Coles) Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- grep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grep.h') diff --git a/grep.h b/grep.h index cd055cdfa..5b083affe 100644 --- a/grep.h +++ b/grep.h @@ -35,7 +35,7 @@ struct grep_pat { const char *origin; int no; enum grep_pat_token token; - const char *pattern; + char *pattern; size_t patternlen; enum grep_header_field field; regex_t regexp; -- cgit v1.2.1