apply --recount: allow "no-op hunks"
[gitweb.git] / t / t7501-commit.sh
index c1d232e92da00dd2b2b22433661b8b3c13d7dcb4..4cae92804d11f75f24bdd6f6517a88c834e7cfc7 100755 (executable)
@@ -47,7 +47,7 @@ test_expect_success 'paths and -a do not mix' '
 test_expect_success PERL 'can use paths with --interactive' '
        echo bong-o-bong >file &&
        # 2: update, 1:st path, that is all, 7: quit
-       ( echo 2; echo 1; echo; echo 7 ) |
+       test_write_lines 2 1 "" 7 |
        git commit -m foo --interactive file &&
        git reset --hard HEAD^
 '
@@ -293,7 +293,7 @@ test_expect_success PERL 'interactive add' '
 test_expect_success PERL "commit --interactive doesn't change index if editor aborts" '
        echo zoo >file &&
        test_must_fail git diff --exit-code >diff1 &&
-       (echo u ; echo "*" ; echo q) |
+       test_write_lines u "*" q |
        (
                EDITOR=: &&
                export EDITOR &&
@@ -411,8 +411,8 @@ test_expect_success 'sign off (1)' '
        git commit -s -m "thank you" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
        (
-               echo thank you
-               echo
+               echo thank you &&
+               echo &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@ -430,9 +430,9 @@ test_expect_success 'sign off (2)' '
 $existing" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
        (
-               echo thank you
-               echo
-               echo $existing
+               echo thank you &&
+               echo &&
+               echo $existing &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@ -450,9 +450,9 @@ test_expect_success 'signoff gap' '
 $alt" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
-               echo welcome
-               echo
-               echo $alt
+               echo welcome &&
+               echo &&
+               echo $alt &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@ -470,11 +470,11 @@ We have now
 $alt" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
-               echo welcome
-               echo
-               echo We have now
-               echo $alt
-               echo
+               echo welcome &&
+               echo &&
+               echo We have now &&
+               echo $alt &&
+               echo &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@ -491,11 +491,11 @@ non-trailer line
 Myfooter: x" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
-               echo subject
-               echo
-               echo non-trailer line
-               echo Myfooter: x
-               echo
+               echo subject &&
+               echo &&
+               echo non-trailer line &&
+               echo Myfooter: x &&
+               echo &&
                echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
        ) >expected &&
        test_cmp expected actual &&
@@ -508,10 +508,10 @@ non-trailer line
 Myfooter: x" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
-               echo subject
-               echo
-               echo non-trailer line
-               echo Myfooter: x
+               echo subject &&
+               echo &&
+               echo non-trailer line &&
+               echo Myfooter: x &&
                echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
        ) >expected &&
        test_cmp expected actual
@@ -524,10 +524,10 @@ test_expect_success 'multiple -m' '
        git commit -m "one" -m "two" -m "three" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
        (
-               echo one
-               echo
-               echo two
-               echo
+               echo one &&
+               echo &&
+               echo two &&
+               echo &&
                echo three
        ) >expected &&
        test_cmp expected actual
@@ -675,7 +675,7 @@ test_expect_success '--dry-run with conflicts fixed from a merge' '
        git checkout -b branch-2 HEAD^1 &&
        echo "commit-2-state" >test-file &&
        git commit -m "commit 2" -i test-file &&
-       ! $(git merge --no-commit commit-1) &&
+       test_must_fail git merge --no-commit commit-1 &&
        echo "commit-2-state" >test-file &&
        git add test-file &&
        git commit --dry-run &&