Change xdl_merge to generate output even for null merges
[gitweb.git] / t / t4012-diff-binary.sh
index eced1f30fb8475739aef52230bbb79946a0f76d8..eac12712dbcf7a9f59c6c8ae0e5772b19662ab8a 100755 (executable)
@@ -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,30 @@ 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"'
 
+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 <current &&
+       echo Q >expected &&
+       nul_to_q <binary >actual &&
+       test_cmp expected actual
+'
+
 test_done