Merge branch 'jk/suppress-clang-warning'
[gitweb.git] / t / t3404-rebase-interactive.sh
index 7a7176088bc7c7e8a75a70538871a438c0667503..15dcbd42d367c3ef6b487e0f235ad201b6cf8413 100755 (executable)
@@ -29,12 +29,6 @@ Initial setup:
 
 . "$TEST_DIRECTORY"/lib-rebase.sh
 
-test_cmp_rev () {
-       git rev-parse --verify "$1" >expect.rev &&
-       git rev-parse --verify "$2" >actual.rev &&
-       test_cmp expect.rev actual.rev
-}
-
 set_fake_editor
 
 # WARNING: Modifications to the initial repository can change the SHA ID used
@@ -922,4 +916,36 @@ test_expect_success 'rebase -i --root fixup root commit' '
        test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
 '
 
+test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '
+       git reset --hard &&
+       git checkout conflict-branch &&
+       test_must_fail git rebase --onto HEAD~2 HEAD~ &&
+       test_must_fail git rebase --edit-todo &&
+       git rebase --abort
+'
+
+test_expect_success 'rebase --edit-todo can be used to modify todo' '
+       git reset --hard &&
+       git checkout no-conflict-branch^0 &&
+       FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 &&
+       FAKE_LINES="2 1" git rebase --edit-todo &&
+       git rebase --continue
+       test M = $(git cat-file commit HEAD^ | sed -ne \$p) &&
+       test L = $(git cat-file commit HEAD | sed -ne \$p)
+'
+
+test_expect_success 'rebase -i respects core.commentchar' '
+       git reset --hard &&
+       git checkout E^0 &&
+       git config core.commentchar "\\" &&
+       test_when_finished "git config --unset core.commentchar" &&
+       write_script remove-all-but-first.sh <<-\EOF &&
+       sed -e "2,\$s/^/\\\\/" "$1" >"$1.tmp" &&
+       mv "$1.tmp" "$1"
+       EOF
+       test_set_editor "$(pwd)/remove-all-but-first.sh" &&
+       git rebase -i B &&
+       test B = $(git cat-file commit HEAD^ | sed -ne \$p)
+'
+
 test_done