From 83356d441fdb31aab1ec837ab29f58f19273511c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 1 Dec 2024 17:07:57 +0100 Subject: [PATCH] Fix moving a commit across an exec todo --- pkg/utils/rebase_todo.go | 4 ++-- pkg/utils/rebase_todo_test.go | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/utils/rebase_todo.go b/pkg/utils/rebase_todo.go index eedb3bab1..6be9fd6b5 100644 --- a/pkg/utils/rebase_todo.go +++ b/pkg/utils/rebase_todo.go @@ -286,9 +286,9 @@ func RemoveUpdateRefsForCopiedBranch(fileName string, commentChar byte) error { } // We render a todo in the commits view if it's a commit or if it's an -// update-ref. We don't render label, reset, or comment lines. +// update-ref or exec. We don't render label, reset, or comment lines. func isRenderedTodo(t todo.Todo) bool { - return t.Commit != "" || t.Command == todo.UpdateRef + return t.Commit != "" || t.Command == todo.UpdateRef || t.Command == todo.Exec } func DropMergeCommit(fileName string, hash string, commentChar byte) error { diff --git a/pkg/utils/rebase_todo_test.go b/pkg/utils/rebase_todo_test.go index 60093bb21..180c6371f 100644 --- a/pkg/utils/rebase_todo_test.go +++ b/pkg/utils/rebase_todo_test.go @@ -89,12 +89,8 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { todoToMoveDown: Todo{Hash: "5678"}, expectedErr: "", expectedTodos: []todo.Todo{ - /* EXPECTED: {Command: todo.Pick, Commit: "1234"}, {Command: todo.Pick, Commit: "5678"}, - ACTUAL: */ - {Command: todo.Pick, Commit: "5678"}, - {Command: todo.Pick, Commit: "1234"}, {Command: todo.Exec, ExecCommand: "make test"}, }, }, @@ -250,12 +246,8 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { expectedErr: "", expectedTodos: []todo.Todo{ {Command: todo.Exec, ExecCommand: "make test"}, - /* EXPECTED: {Command: todo.Pick, Commit: "1234"}, {Command: todo.Pick, Commit: "5678"}, - ACTUAL: */ - {Command: todo.Pick, Commit: "5678"}, - {Command: todo.Pick, Commit: "1234"}, }, }, {