summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-14 12:57:18 -0800
committerJunio C Hamano <gitster@pobox.com>2012-02-14 12:57:18 -0800
commit10439fc0effb194e1ce2cd4db8fbd69cfaf23656 (patch)
treecea18a64ff350d773df72e5776f415e37401c937 /t
parent84f3d6458b0e71bd7a6c4f05ed3bd43b8fb9a9e4 (diff)
parent9dd5245c1043dd18fd7b3f44b9e51eef7e4b58d8 (diff)
downloadgit-10439fc0effb194e1ce2cd4db8fbd69cfaf23656.tar.gz
Merge branch 'jk/grep-binary-attribute'
* 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 917a264eea..fd6410fc71 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