Code

t3412: use log|name-rev instead of log --graph
[git.git] / t / t4104-apply-boundary.sh
index 64f34e329867cbef3c122c96a63cfd844b0953af..0e3ce3611d9e83ab290ce034f2439961864ce30a 100755 (executable)
@@ -27,6 +27,15 @@ test_expect_success setup '
        git diff victim >add-a-patch.with &&
        git diff --unified=0 >add-a-patch.without &&
 
+       : insert at line two
+       for i in b a '"$L"' y
+       do
+               echo $i
+       done >victim &&
+       cat victim >insert-a-expect &&
+       git diff victim >insert-a-patch.with &&
+       git diff --unified=0 >insert-a-patch.without &&
+
        : modify at the head
        for i in a '"$L"' y
        do
@@ -55,7 +64,7 @@ test_expect_success setup '
        git diff --unified=0 >add-z-patch.without &&
 
        : modify at the tail
-       for i in a '"$L"' y
+       for i in b '"$L"' z
        do
                echo $i
        done >victim &&
@@ -81,7 +90,7 @@ do
        with) u= ;;
        without) u='--unidiff-zero ' ;;
        esac
-       for kind in add-a add-z mod-a mod-z del-a del-z
+       for kind in add-a add-z insert-a mod-a mod-z del-a del-z
        do
                test_expect_success "apply $kind-patch $with context" '
                        cat original >victim &&
@@ -90,12 +99,12 @@ do
                                cat '"$kind-patch.$with"'
                                (exit 1)
                        } &&
-                       git diff '"$kind"'-expect victim
+                       test_cmp '"$kind"'-expect victim
                '
        done
 done
 
-for kind in add-a add-z mod-a mod-z del-a del-z
+for kind in add-a add-z insert-a mod-a mod-z del-a del-z
 do
        rm -f $kind-ng.without
        sed     -e "s/^diff --git /diff /" \
@@ -108,8 +117,21 @@ do
                        cat '"$kind-ng.without"'
                        (exit 1)
                } &&
-               git diff '"$kind"'-expect victim
+               test_cmp '"$kind"'-expect victim
        '
 done
 
+test_expect_success 'two lines' '
+
+       >file &&
+       git add file &&
+       echo aaa >file &&
+       git diff >patch &&
+       git add file &&
+       echo bbb >file &&
+       git add file &&
+       test_must_fail git apply --check patch
+
+'
+
 test_done