summaryrefslogtreecommitdiff
path: root/t/t4209-log-pickaxe.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-14 23:29:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-14 23:29:31 (GMT)
commitecdc7cbbac04241f1e5a90fb1fff13cff2ed7a82 (patch)
tree865b4149a211b52800c1051950633790b7c9be26 /t/t4209-log-pickaxe.sh
parent932b867be0cec606ec7355fc25de13ace42f4c71 (diff)
parente0e7cb8080cb4a0b3a24f288bf363fe517b49790 (diff)
downloadgit-ecdc7cbbac04241f1e5a90fb1fff13cff2ed7a82.zip
git-ecdc7cbbac04241f1e5a90fb1fff13cff2ed7a82.tar.gz
git-ecdc7cbbac04241f1e5a90fb1fff13cff2ed7a82.tar.bz2
Merge branch 'tb/log-G-binary'
"git log -G<regex>" looked for a hunk in the "git log -p" patch output that contained a string that matches the given pattern. Optimize this code to ignore binary files, which by default will not show any hunk that would match any pattern (unless textconv or the --text option is in effect, that is). * tb/log-G-binary: log -G: ignore binary files
Diffstat (limited to 't/t4209-log-pickaxe.sh')
-rwxr-xr-xt/t4209-log-pickaxe.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh
index 844df76..5d06f5f 100755
--- a/t/t4209-log-pickaxe.sh
+++ b/t/t4209-log-pickaxe.sh
@@ -106,4 +106,39 @@ test_expect_success 'log -S --no-textconv (missing textconv tool)' '
rm .gitattributes
'
+test_expect_success 'setup log -[GS] binary & --text' '
+ git checkout --orphan GS-binary-and-text &&
+ git read-tree --empty &&
+ printf "a\na\0a\n" >data.bin &&
+ git add data.bin &&
+ git commit -m "create binary file" data.bin &&
+ printf "a\na\0a\n" >>data.bin &&
+ git commit -m "modify binary file" data.bin &&
+ git rm data.bin &&
+ git commit -m "delete binary file" data.bin &&
+ git log >full-log
+'
+
+test_expect_success 'log -G ignores binary files' '
+ git log -Ga >log &&
+ test_must_be_empty log
+'
+
+test_expect_success 'log -G looks into binary files with -a' '
+ git log -a -Ga >log &&
+ test_cmp log full-log
+'
+
+test_expect_success 'log -G looks into binary files with textconv filter' '
+ test_when_finished "rm .gitattributes" &&
+ echo "* diff=bin" >.gitattributes &&
+ git -c diff.bin.textconv=cat log -Ga >log &&
+ test_cmp log full-log
+'
+
+test_expect_success 'log -S looks into binary files' '
+ git log -Sa >log &&
+ test_cmp log full-log
+'
+
test_done