t7008: demonstrate behavior of grep with textconv

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>

Michael J Gruber committed May 10, 2013 at 17:10 UTC 97f6a9c975bb14688b60a5134069159b4cae1a07
1 file changed +31
t/t7008-grep-binary.sh
+31
@@ -145,4 +145,35 @@ test_expect_success 'grep respects not-binary diff attribute' '
145 test_cmp expect actual
146 '
147
148 +cat >nul_to_q_textconv <<'EOF'
149 +#!/bin/sh
150 +"$PERL_PATH" -pe 'y/\000/Q/' < "$1"
151 +EOF
152 +chmod +x nul_to_q_textconv
153 +
154 +test_expect_success 'setup textconv filters' '
155 + echo a diff=foo >.gitattributes &&
156 + git config diff.foo.textconv "\"$(pwd)\""/nul_to_q_textconv
157 +'
158 +
159 +test_expect_success 'grep does not honor textconv' '
160 + test_must_fail git grep Qfile
161 +'
162 +
163 +test_expect_failure 'grep --textconv honors textconv' '
164 + echo "a:binaryQfile" >expect &&
165 + git grep --textconv Qfile >actual &&
166 + test_cmp expect actual
167 +'
168 +
169 +test_expect_success 'grep --no-textconv does not honor textconv' '
170 + test_must_fail git grep --no-textconv Qfile
171 +'
172 +
173 +test_expect_failure 'grep --textconv blob honors textconv' '
174 + echo "HEAD:a:binaryQfile" >expect &&
175 + git grep --textconv Qfile HEAD:a >actual &&
176 + test_cmp expect actual
177 +'
178 +
179 test_done