diff options
Diffstat (limited to 't/t4031-diff-rewrite-binary.sh')
-rwxr-xr-x | t/t4031-diff-rewrite-binary.sh | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/t/t4031-diff-rewrite-binary.sh b/t/t4031-diff-rewrite-binary.sh index e16c355103..157ed85a79 100755 --- a/t/t4031-diff-rewrite-binary.sh +++ b/t/t4031-diff-rewrite-binary.sh @@ -7,6 +7,8 @@ test_description='rewrite diff on binary file' # We must be large enough to meet the MINIMUM_BREAK_SIZE # requirement. make_file() { + # common first line to help identify rewrite versus regular diff + printf "=\n" >file for i in 1 2 3 4 5 6 7 8 9 10 do for j in 1 2 3 4 5 6 7 8 9 @@ -16,7 +18,7 @@ make_file() { printf "$1\n" done done - done >file + done >>file } test_expect_success 'create binary file with changes' ' @@ -42,4 +44,24 @@ test_expect_success 'rewrite diff can show binary patch' ' grep "GIT binary patch" diff ' +{ + echo "#!$SHELL_PATH" + cat >dump <<'EOF' +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1" +EOF +} >dump +chmod +x dump + +test_expect_success 'setup textconv' ' + echo file diff=foo >.gitattributes && + git config diff.foo.textconv "$PWD"/dump +' + +test_expect_success 'rewrite diff respects textconv' ' + git diff -B >diff && + grep "dissimilarity index" diff && + grep "^-61" diff && + grep "^-0" diff +' + test_done |