summaryrefslogtreecommitdiff
path: root/t/t7810-grep.sh
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-05-20 14:33:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-05-20 22:25:46 (GMT)
commit526a858a99ace6698823740374edc3e35b87901a (patch)
tree7e8e8385829962ef29f0024e8d1ef399e80388e2 /t/t7810-grep.sh
parent2b3873ff34ff937dad729407da4308be6a5bcd66 (diff)
downloadgit-526a858a99ace6698823740374edc3e35b87901a.zip
git-526a858a99ace6698823740374edc3e35b87901a.tar.gz
git-526a858a99ace6698823740374edc3e35b87901a.tar.bz2
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) <torne@google.com> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7810-grep.sh')
-rwxr-xr-xt/t7810-grep.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 6379ad6..bc9a522 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -322,6 +322,11 @@ test_expect_success 'grep -f, multiple patterns' '
test_cmp expected actual
'
+test_expect_success 'grep, multiple patterns' '
+ git grep "$(cat patterns)" >actual &&
+ test_cmp expected actual
+'
+
cat >expected <<EOF
file:foo mmap bar
file:foo_mmap bar