Skip to content

Commit

Permalink
t7008: demonstrate behavior of grep with textconv
Browse files Browse the repository at this point in the history
Currently, "git grep" does not honor any textconv filters, with nor
without --textconv. Demonstrate this in the tests.

The default is expected to remain unchanged.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed May 10, 2013
1 parent 3ac2161 commit 97f6a9c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions t/t7008-grep-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,35 @@ test_expect_success 'grep respects not-binary diff attribute' '
test_cmp expect actual
'

cat >nul_to_q_textconv <<'EOF'
#!/bin/sh
"$PERL_PATH" -pe 'y/\000/Q/' < "$1"
EOF
chmod +x nul_to_q_textconv

test_expect_success 'setup textconv filters' '
echo a diff=foo >.gitattributes &&
git config diff.foo.textconv "\"$(pwd)\""/nul_to_q_textconv
'

test_expect_success 'grep does not honor textconv' '
test_must_fail git grep Qfile
'

test_expect_failure 'grep --textconv honors textconv' '
echo "a:binaryQfile" >expect &&
git grep --textconv Qfile >actual &&
test_cmp expect actual
'

test_expect_success 'grep --no-textconv does not honor textconv' '
test_must_fail git grep --no-textconv Qfile
'

test_expect_failure 'grep --textconv blob honors textconv' '
echo "HEAD:a:binaryQfile" >expect &&
git grep --textconv Qfile HEAD:a >actual &&
test_cmp expect actual
'

test_done

0 comments on commit 97f6a9c

Please sign in to comment.