3 test_description
='rewrite diff on binary file'
7 # We must be large enough to meet the MINIMUM_BREAK_SIZE
10 # common first line to help identify rewrite versus regular diff
12 for i
in 1 2 3 4 5 6 7 8 9 10
14 for j
in 1 2 3 4 5 6 7 8 9
24 test_expect_success
'create binary file with changes' '
30 test_expect_success
'vanilla diff is binary' '
32 grep "Binary files a/file and b/file differ" diff
35 test_expect_success
'rewrite diff is binary' '
37 grep "dissimilarity index" diff &&
38 grep "Binary files a/file and b/file differ" diff
41 test_expect_success
'rewrite diff can show binary patch' '
42 git diff -B --binary >diff &&
43 grep "dissimilarity index" diff &&
44 grep "GIT binary patch" diff
47 test_expect_success
'rewrite diff --numstat shows binary changes' '
48 git diff -B --numstat --summary >diff &&
49 grep -e "- - " diff &&
50 grep " rewrite file" diff
53 test_expect_success
'diff --stat counts binary rewrite as 0 lines' '
54 git diff -B --stat --summary >diff &&
56 test_i18ngrep "0 insertions.*0 deletions" diff &&
57 grep " rewrite file" diff
63 "$PERL_PATH" -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
68 test_expect_success
'setup textconv' '
69 echo file diff=foo >.gitattributes &&
70 git config diff.foo.textconv "\"$(pwd)\""/dump
73 test_expect_success
'rewrite diff respects textconv' '
75 grep "dissimilarity index" diff &&