]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t7600-merge.sh
Merge branch 'vv/merge-squash-with-explicit-commit' into maint
[thirdparty/git.git] / t / t7600-merge.sh
index eeb2222b4a45784cd7b4bfb4924376280eb7762a..4ec5d9ec790a0d54f4883fc118b5df25c94f43f4 100755 (executable)
@@ -233,20 +233,65 @@ test_expect_success 'merge --squash c3 with c7' '
        cat result.9z >file &&
        git commit --no-edit -a &&
 
-       {
-               cat <<-EOF
-               Squashed commit of the following:
+       cat >expect <<-EOF &&
+       Squashed commit of the following:
 
-               $(git show -s c7)
+       $(git show -s c7)
 
-               # Conflicts:
-               #       file
-               EOF
-       } >expect &&
-       git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
+       # Conflicts:
+       #       file
+       EOF
+       git cat-file commit HEAD >raw &&
+       sed -e '1,/^$/d' raw >actual &&
        test_cmp expect actual
 '
 
+test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
+       git config commit.cleanup scissors &&
+       git reset --hard c3 &&
+       test_must_fail git merge c7 &&
+       cat result.9z >file &&
+       git commit --no-edit -a &&
+
+       cat >expect <<-\EOF &&
+       Merge tag '"'"'c7'"'"'
+
+       # ------------------------ >8 ------------------------
+       # Do not modify or remove the line above.
+       # Everything below it will be ignored.
+       #
+       # Conflicts:
+       #       file
+       EOF
+       git cat-file commit HEAD >raw &&
+       sed -e '1,/^$/d' raw >actual &&
+       test_i18ncmp expect actual
+'
+
+test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
+       git config commit.cleanup scissors &&
+       git reset --hard c3 &&
+       test_must_fail git merge --squash c7 &&
+       cat result.9z >file &&
+       git commit --no-edit -a &&
+
+       cat >expect <<-EOF &&
+       Squashed commit of the following:
+
+       $(git show -s c7)
+
+       # ------------------------ >8 ------------------------
+       # Do not modify or remove the line above.
+       # Everything below it will be ignored.
+       #
+       # Conflicts:
+       #       file
+       EOF
+       git cat-file commit HEAD >raw &&
+       sed -e '1,/^$/d' raw >actual &&
+       test_i18ncmp expect actual
+'
+
 test_debug 'git log --graph --decorate --oneline --all'
 
 test_expect_success 'merge c1 with c2 and c3' '
@@ -686,10 +731,10 @@ cat >editor <<\EOF
 (
        echo "Merge work done on the side branch c1"
        echo
-       cat <"$1"
+       cat "$1"
 ) >"$1.tmp" && mv "$1.tmp" "$1"
 # strip comments and blank lines from end of message
-sed -e '/^#/d' < "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > expected
+sed -e '/^#/d' "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' >expected
 EOF
 chmod 755 editor
 
@@ -774,14 +819,14 @@ test_expect_success 'set up mod-256 conflict scenario' '
        git commit -m base &&
 
        # one side changes the first line of each to "master"
-       sed s/-1/-master/ <file >tmp &&
+       sed s/-1/-master/ file >tmp &&
        mv tmp file &&
        git commit -am master &&
 
        # and the other to "side"; merging the two will
        # yield 256 separate conflicts
        git checkout -b side HEAD^ &&
-       sed s/-1/-side/ <file >tmp &&
+       sed s/-1/-side/ file >tmp &&
        mv tmp file &&
        git commit -am side
 '
@@ -820,7 +865,7 @@ EOF
 test_expect_success EXECKEEPSPID 'killed merge can be completed with --continue' '
        git reset --hard c0 &&
        ! "$SHELL_PATH" -c '\''
-         echo kill -TERM $$ >> .git/FAKE_EDITOR
+         echo kill -TERM $$ >>.git/FAKE_EDITOR
          GIT_EDITOR=.git/FAKE_EDITOR
          export GIT_EDITOR
          exec git merge --no-ff --edit c1'\'' &&