aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-21 14:57:05 -0800
committerJunio C Hamano <gitster@pobox.com>2012-02-21 14:57:05 -0800
commit6f61eb201799ee83c3a82f1f097c18b3854c0c03 (patch)
treecf6db24e651eb191fd373d22a2929dd90be1af41 /t
parent093b194cc5570c825173a90538a4c212bc64bc7f (diff)
parent9dd5245c1043dd18fd7b3f44b9e51eef7e4b58d8 (diff)
downloadgit-6f61eb201799ee83c3a82f1f097c18b3854c0c03.tar.gz
git-6f61eb201799ee83c3a82f1f097c18b3854c0c03.tar.xz
Merge branch 'jk/grep-binary-attribute' into maint
* jk/grep-binary-attribute: grep: pre-load userdiff drivers when threaded grep: load file data after checking binary-ness grep: respect diff attributes for binary-ness grep: cache userdiff_driver in grep_source grep: drop grep_buffer's "name" parameter convert git-grep to use grep_source interface grep: refactor the concept of "grep source" into an object grep: move sha1-reading mutex into low-level code grep: make locking flag global
Diffstat (limited to 't')
-rwxr-xr-xt/t7008-grep-binary.sh24
1 files changed, 24 insertions, 0 deletions
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 y<NUL>x 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