aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-10-29 04:13:16 -0400
committerJeff King <peff@peff.net>2012-10-29 04:13:16 -0400
commite034d1bb927c17a3406a2bdbb8ccf710677a139d (patch)
tree58bc69a25324468d97a49aeb942c938211ccd442 /t
parent58f3f9893dc287bd5b7ec4bbd3fc56b77e126e6c (diff)
parent55c61688ea1e41f4a8c26f957bf1bc43cd39ed97 (diff)
downloadgit-e034d1bb927c17a3406a2bdbb8ccf710677a139d.tar.gz
git-e034d1bb927c17a3406a2bdbb8ccf710677a139d.tar.xz
Merge branch 'nd/grep-true-path'
"git grep -e pattern <tree>" asked the attribute system to read "<tree>:.gitattributes" file in the working tree, which was nonsense. * nd/grep-true-path: grep: stop looking at random places for .gitattributes
Diffstat (limited to 't')
-rwxr-xr-xt/t7008-grep-binary.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t7008-grep-binary.sh b/t/t7008-grep-binary.sh
index fd6410fc7..26f831984 100755
--- a/t/t7008-grep-binary.sh
+++ b/t/t7008-grep-binary.sh
@@ -111,6 +111,28 @@ test_expect_success 'grep respects binary diff attribute' '
test_cmp expect actual
'
+test_expect_success 'grep --cached respects binary diff attribute' '
+ git grep --cached text t >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'grep --cached respects binary diff attribute (2)' '
+ git add .gitattributes &&
+ rm .gitattributes &&
+ git grep --cached text t >actual &&
+ test_when_finished "git rm --cached .gitattributes" &&
+ test_when_finished "git checkout .gitattributes" &&
+ test_cmp expect actual
+'
+
+test_expect_success 'grep revision respects binary diff attribute' '
+ git commit -m new &&
+ echo "Binary file HEAD:t matches" >expect &&
+ git grep text HEAD -- t >actual &&
+ test_when_finished "git reset HEAD^" &&
+ test_cmp expect actual
+'
+
test_expect_success 'grep respects not-binary diff attribute' '
echo binQary | q_to_nul >b &&
git add b &&