Code

git-apply --verbose
[git.git] / t / t4117-apply-reject.sh
index 1cf9a2e7a7a0fe4cea4b68ab4792ac26b3247bb5..b4de075a3e5df86fe399f9133f7437c4a8d8e26d 100755 (executable)
@@ -57,6 +57,17 @@ test_expect_success 'apply without --reject should fail' '
        diff -u file1 saved.file1
 '
 
+test_expect_success 'apply without --reject should fail' '
+
+       if git apply --verbose patch.1
+       then
+               echo "Eh? Why?"
+               exit 1
+       fi
+
+       diff -u file1 saved.file1
+'
+
 test_expect_success 'apply with --reject should fail but update the file' '
 
        cat saved.file1 >file1 &&
@@ -106,4 +117,41 @@ test_expect_success 'apply with --reject should fail but update the file' '
 
 '
 
+test_expect_success 'the same test with --verbose' '
+
+       cat saved.file1 >file1 &&
+       rm -f file1.rej file2.rej file2 &&
+
+       if git apply --reject --verbose patch.2 >rejects
+       then
+               echo "succeeds with --reject?"
+               exit 1
+       fi
+
+       test -f file1 && {
+               echo "file1 still exists?"
+               exit 1
+       }
+       diff -u file2 expected &&
+
+       cat file2.rej &&
+
+       if test -f file1.rej
+       then
+               echo "file2 should not have been touched"
+               exit 1
+       fi
+
+'
+
+test_expect_success 'apply cleanly with --verbose' '
+
+       git cat-file -p HEAD:file1 >file1 &&
+       rm -f file?.rej file2 &&
+
+       git apply --verbose patch.1 &&
+
+       diff -u file1 clean
+'
+
 test_done