summaryrefslogtreecommitdiff
path: root/t/t4012-diff-binary.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4012-diff-binary.sh')
-rwxr-xr-xt/t4012-diff-binary.sh23
1 files changed, 18 insertions, 5 deletions
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index eced1f3..05ec062 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \
'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
git update-index --add a b c d &&
echo git >a &&
- cat ../test4012.png >b &&
+ cat "$TEST_DIRECTORY"/test4012.png >b &&
echo git >c &&
cat b b >d'
@@ -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.
@@ -61,7 +61,7 @@ test_expect_success 'apply detecting corrupt patch correctly' \
detected=`sed -ne "${detected}p" broken` &&
test "$detected" = xCIT'
-test_expect_success 'initial commit' 'git-commit -a -m initial'
+test_expect_success 'initial commit' 'git commit -a -m initial'
# Try removal (b), modification (d), and creation (e).
test_expect_success 'diff-index with --binary' \
@@ -72,9 +72,22 @@ test_expect_success 'diff-index with --binary' \
git apply --stat --summary current'
test_expect_success 'apply binary patch' \
- 'git-reset --hard &&
+ 'git reset --hard &&
git apply --binary --index <current &&
tree1=`git write-tree` &&
test "$tree1" = "$tree0"'
+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 <current &&
+ echo Q >expected &&
+ nul_to_q <binary >actual &&
+ test_cmp expected actual
+'
+
test_done