aboutsummaryrefslogtreecommitdiff
path: root/t/t7002-grep.sh
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-07-02 00:07:24 +0200
committerJunio C Hamano <gitster@pobox.com>2009-07-01 19:16:50 -0700
commit60ecac98ed6f420c6bf823491074219087c749d4 (patch)
tree480471031679f5d7f88dea0c673412f1ce03890b /t/t7002-grep.sh
parent2944e4e6145bdfcb1a8730d7da671786d72c86ed (diff)
downloadgit-60ecac98ed6f420c6bf823491074219087c749d4.tar.gz
git-60ecac98ed6f420c6bf823491074219087c749d4.tar.xz
grep -p: support user defined regular expressions
Respect the userdiff attributes and config settings when looking for lines with function definitions in git grep -p. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7002-grep.sh')
-rwxr-xr-xt/t7002-grep.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index ef59ab994..b13aa7e89 100755
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -244,11 +244,24 @@ test_expect_success 'grep with CE_VALID file' '
'
cat >expected <<EOF
+hello.c=#include <stdio.h>
+hello.c: return 0;
+EOF
+
+test_expect_success 'grep -p with userdiff' '
+ git config diff.custom.funcname "^#" &&
+ echo "hello.c diff=custom" >.gitattributes &&
+ git grep -p return >actual &&
+ test_cmp expected actual
+'
+
+cat >expected <<EOF
hello.c=int main(int argc, const char **argv)
hello.c: return 0;
EOF
test_expect_success 'grep -p' '
+ rm -f .gitattributes &&
git grep -p return >actual &&
test_cmp expected actual
'