summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar René Scharfe <rene.scharfe@lsrfire.ath.cx>2009-07-02 00:07:24 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-07-01 19:16:50 -0700
commit60ecac98ed6f420c6bf823491074219087c749d4 (patch)
tree480471031679f5d7f88dea0c673412f1ce03890b /t
parentgrep: add option -p/--show-function (diff)
downloadtgif-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')
-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 ef59ab9941..b13aa7e89a 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
'