X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7008-grep-binary.sh;h=fd6410fc7149ed381d4d09120089859281e40696;hb=c17ff2a36160ae51a1cefa9fe8f067dbeb33e884;hp=917a264eea6c6b3593e9f19caadbef715daace20;hpb=7f1068e21e5840fca0787f0925e62148b2f873ed;p=git.git diff --git a/t/t7008-grep-binary.sh b/t/t7008-grep-binary.sh index 917a264ee..fd6410fc7 100755 --- a/t/t7008-grep-binary.sh +++ b/t/t7008-grep-binary.sh @@ -99,4 +99,28 @@ test_expect_success 'git grep yx a' " test_must_fail git grep -f f a " +test_expect_success 'grep respects binary diff attribute' ' + echo text >t && + git add t && + echo t:text >expect && + git grep text t >actual && + test_cmp expect actual && + echo "t -diff" >.gitattributes && + echo "Binary file t matches" >expect && + git grep text t >actual && + test_cmp expect actual +' + +test_expect_success 'grep respects not-binary diff attribute' ' + echo binQary | q_to_nul >b && + git add b && + echo "Binary file b matches" >expect && + git grep bin b >actual && + test_cmp expect actual && + echo "b diff" >.gitattributes && + echo "b:binQary" >expect && + git grep bin b | nul_to_q >actual && + test_cmp expect actual +' + test_done