Merge branch 'jn/mailmap-update' into maint
[gitweb.git] / t / t3430-rebase-merges.sh
index 2e767d4f1ec97362b47dec41497d531744f0f219..aa7bfc88ece9de7f542f354c78b7be9ec6d2bdf7 100755 (executable)
@@ -345,4 +345,55 @@ test_expect_success 'labels that are object IDs are rewritten' '
        ! grep "^label $third$" .git/ORIGINAL-TODO
 '
 
+test_expect_success 'octopus merges' '
+       git checkout -b three &&
+       test_commit before-octopus &&
+       test_commit three &&
+       git checkout -b two HEAD^ &&
+       test_commit two &&
+       git checkout -b one HEAD^ &&
+       test_commit one &&
+       test_tick &&
+       (GIT_AUTHOR_NAME="Hank" GIT_AUTHOR_EMAIL="hank@sea.world" \
+        git merge -m "Tüntenfüsch" two three) &&
+
+       : fast forward if possible &&
+       before="$(git rev-parse --verify HEAD)" &&
+       test_tick &&
+       git rebase -i -r HEAD^^ &&
+       test_cmp_rev HEAD $before &&
+
+       test_tick &&
+       git rebase -i --force -r HEAD^^ &&
+       test "Hank" = "$(git show -s --format=%an HEAD)" &&
+       test "$before" != $(git rev-parse HEAD) &&
+       test_cmp_graph HEAD^^.. <<-\EOF
+       *-.   Tüntenfüsch
+       |\ \
+       | | * three
+       | * | two
+       | |/
+       * | one
+       |/
+       o before-octopus
+       EOF
+'
+
+test_expect_success 'with --autosquash and --exec' '
+       git checkout -b with-exec H &&
+       echo Booh >B.t &&
+       test_tick &&
+       git commit --fixup B B.t &&
+       write_script show.sh <<-\EOF &&
+       subject="$(git show -s --format=%s HEAD)"
+       content="$(git diff HEAD^! | tail -n 1)"
+       echo "$subject: $content"
+       EOF
+       test_tick &&
+       git rebase -ir --autosquash --exec ./show.sh A >actual &&
+       grep "B: +Booh" actual &&
+       grep "E: +Booh" actual &&
+       grep "G: +G" actual
+'
+
 test_done