reflog tests: test for the "points nowhere" warning
[gitweb.git] / t / t3430-rebase-merges.sh
index 2e767d4f1ec97362b47dec41497d531744f0f219..4c69255ee6b14bdd52b6f840e2e528c182cb23ec 100755 (executable)
@@ -125,7 +125,7 @@ test_expect_success '`reset` refuses to overwrite untracked files' '
        : >dont-overwrite-untracked.t &&
        echo "reset refs/tags/dont-overwrite-untracked" >script-from-scratch &&
        test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
-       test_must_fail git rebase -r HEAD &&
+       test_must_fail git rebase -ir HEAD &&
        git rebase --abort
 '
 
@@ -345,4 +345,71 @@ 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_expect_success '--continue after resolving conflicts after a merge' '
+       git checkout -b already-has-g E &&
+       git cherry-pick E..G &&
+       test_commit H2 &&
+
+       git checkout -b conflicts-in-merge H &&
+       test_commit H2 H2.t conflicts H2-conflict &&
+       test_must_fail git rebase -r already-has-g &&
+       grep conflicts H2.t &&
+       echo resolved >H2.t &&
+       git add -u &&
+       git rebase --continue &&
+       test_must_fail git rev-parse --verify HEAD^2 &&
+       test_path_is_missing .git/MERGE_HEAD
+'
+
 test_done