]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t4117-apply-reject.sh
Fix "read-tree -m A B" priming the cache-tree
[git.git] / t / t4117-apply-reject.sh
index 1cf9a2e7a7a0fe4cea4b68ab4792ac26b3247bb5..e9ccd161ee96a5bdbb4bf77de406ea51dacfb5de 100755 (executable)
@@ -3,7 +3,7 @@
 # Copyright (c) 2005 Junio C Hamano
 #
 
-test_description='git-apply with rejects
+test_description='git apply with rejects
 
 '
 
@@ -54,7 +54,18 @@ test_expect_success 'apply without --reject should fail' '
                exit 1
        fi
 
-       diff -u file1 saved.file1
+       test_cmp file1 saved.file1
+'
+
+test_expect_success 'apply without --reject should fail' '
+
+       if git apply --verbose patch.1
+       then
+               echo "Eh? Why?"
+               exit 1
+       fi
+
+       test_cmp file1 saved.file1
 '
 
 test_expect_success 'apply with --reject should fail but update the file' '
@@ -68,7 +79,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
                exit 1
        fi
 
-       diff -u file1 expected &&
+       test_cmp file1 expected &&
 
        cat file1.rej &&
 
@@ -94,7 +105,34 @@ test_expect_success 'apply with --reject should fail but update the file' '
                echo "file1 still exists?"
                exit 1
        }
-       diff -u file2 expected &&
+       test_cmp file2 expected &&
+
+       cat file2.rej &&
+
+       if test -f file1.rej
+       then
+               echo "file2 should not have been touched"
+               exit 1
+       fi
+
+'
+
+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
+       }
+       test_cmp file2 expected &&
 
        cat file2.rej &&
 
@@ -106,4 +144,14 @@ test_expect_success 'apply with --reject should fail but update the file' '
 
 '
 
+test_expect_success 'apply cleanly with --verbose' '
+
+       git cat-file -p HEAD:file1 >file1 &&
+       rm -f file?.rej file2 &&
+
+       git apply --verbose patch.1 &&
+
+       test_cmp file1 clean
+'
+
 test_done