]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3404-rebase-interactive.sh
Merge branch 'pw/rebase-i-after-failure' into maint-2.42
[thirdparty/git.git] / t / t3404-rebase-interactive.sh
index 71da9c465a1fb2095621c5047b5e7a1b77a42dc7..939fe8dfbc7fe2245765c296155ea8340c06ec9f 100755 (executable)
@@ -1625,6 +1625,32 @@ test_expect_success 'static check of bad command' '
        test C = $(git cat-file commit HEAD^ | sed -ne \$p)
 '
 
+test_expect_success 'the first command cannot be a fixup' '
+       rebase_setup_and_clean fixup-first &&
+
+       cat >orig <<-EOF &&
+       fixup $(git log -1 --format="%h %s" B)
+       pick $(git log -1 --format="%h %s" C)
+       EOF
+
+       (
+               set_replace_editor orig &&
+               test_must_fail git rebase -i A 2>actual
+       ) &&
+       grep "cannot .fixup. without a previous commit" actual &&
+       grep "You can fix this with .git rebase --edit-todo.." actual &&
+       # verify that the todo list has not been truncated
+       grep -v "^#" .git/rebase-merge/git-rebase-todo >actual &&
+       test_cmp orig actual &&
+
+       test_must_fail git rebase --edit-todo 2>actual &&
+       grep "cannot .fixup. without a previous commit" actual &&
+       grep "You can fix this with .git rebase --edit-todo.." actual &&
+       # verify that the todo list has not been truncated
+       grep -v "^#" .git/rebase-merge/git-rebase-todo >actual &&
+       test_cmp orig actual
+'
+
 test_expect_success 'tabs and spaces are accepted in the todolist' '
        rebase_setup_and_clean indented-comment &&
        write_script add-indent.sh <<-\EOF &&