X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=t%2Ft7002-grep.sh;h=68b2b92879c5e187a33d34d3daf54bb3c131e40f;hb=784c099a30368af4238e2713e6220688119239a1;hp=00a7d762ce6867d4f14d8157ddee4daec3dea0f6;hpb=9673198ee867cea4ed70d2cf54c1a2eb8f27bb46;p=git.git diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 00a7d762c..68b2b9287 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Junio C Hamano # -test_description='git grep -w +test_description='git grep various. ' . ./test-lib.sh @@ -19,7 +19,9 @@ test_expect_success setup ' echo x x xx x >x && echo y yy >y && echo zzz > z && - git add file x y z && + mkdir t && + echo test >t/t && + git add file x y z t/t && git commit -m initial ' @@ -80,6 +82,35 @@ do diff expected actual fi ' + + test_expect_success "grep $L (t-1)" ' + echo "${HC}t/t:1:test" >expected && + git grep -n -e test $H >actual && + diff expected actual + ' + + test_expect_success "grep $L (t-2)" ' + echo "${HC}t:1:test" >expected && + ( + cd t && + git grep -n -e test $H + ) >actual && + diff expected actual + ' + + test_expect_success "grep $L (t-3)" ' + echo "${HC}t/t:1:test" >expected && + ( + cd t && + git grep --full-name -n -e test $H + ) >actual && + diff expected actual + ' + + test_expect_failure "grep -c $L (no /dev/null)" ' + git grep -c test $H | grep -q "/dev/null" + ' + done test_done