X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft4012-diff-binary.sh;h=3cf5b5c4ea05d861d75aa146a52d7d273dcaa4cb;hb=2f91bcfa9d8d1f443012e3e92092f464f3bb3557;hp=b8ec6e90afb970b1b2540e30901b2f058522544e;hpb=dde4af4313c6fba5269df384d97ef4fa3ab5971d;p=git.git diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh index b8ec6e90a..3cf5b5c4e 100755 --- a/t/t4012-diff-binary.sh +++ b/t/t4012-diff-binary.sh @@ -25,11 +25,11 @@ cat > expected <<\EOF EOF test_expect_success 'diff without --binary' \ 'git diff | git apply --stat --summary >current && - cmp current expected' + test_cmp expected current' test_expect_success 'diff with --binary' \ 'git diff --binary | git apply --stat --summary >current && - cmp current expected' + test_cmp expected current' # apply needs to be able to skip the binary material correctly # in order to report the line number of a corrupt patch. @@ -77,4 +77,25 @@ test_expect_success 'apply binary patch' \ tree1=`git write-tree` && test "$tree1" = "$tree0"' +q_to_nul() { + perl -pe 'y/Q/\000/' +} + +nul_to_q() { + perl -pe 'y/\000/Q/' +} + +test_expect_success 'diff --no-index with binary creation' ' + echo Q | q_to_nul >binary && + (:# hide error code from diff, which just indicates differences + git diff --binary --no-index /dev/null binary >current || + true + ) && + rm binary && + git apply --binary expected && + nul_to_q actual && + test_cmp expected actual +' + test_done