diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/git_commands/commit_loader.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 3 | ||||
-rw-r--r-- | pkg/i18n/english.go | 2 | ||||
-rw-r--r-- | pkg/integration/tests/interactive_rebase/show_exec_todos.go | 57 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
5 files changed, 65 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index f116ded1f..f9cfff141 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -344,6 +344,8 @@ func (self *CommitLoader) getRebasingCommits(rebaseMode enums.RebaseMode) []*mod for _, t := range todos { if t.Command == todo.UpdateRef { t.Msg = t.Ref + } else if t.Command == todo.Exec { + t.Msg = t.ExecCommand } else if t.Commit == "" { // Command does not have a commit associated, skip continue diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index f8717f413..de5116b74 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -284,6 +284,9 @@ func (self *LocalCommitsController) GetOnRenderToMain() func() error { map[string]string{ "ref": strings.TrimPrefix(commit.Name, "refs/heads/"), })) + } else if commit.Action == todo.Exec { + task = types.NewRenderStringTask( + self.c.Tr.ExecCommandHere + "\n\n" + commit.Name) } else { cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Hash, self.c.Modes().Filtering.GetPath()) task = types.NewRunPtyTask(cmdObj.GetCmd()) diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index d32aafbf2..7aabbbc2b 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -164,6 +164,7 @@ type TranslationSet struct { RewordCommitEditor string NoCommitsThisBranch string UpdateRefHere string + ExecCommandHere string Error string Undo string UndoReflog string @@ -1093,6 +1094,7 @@ func EnglishTranslationSet() TranslationSet { SquashTooltip: "Squash the selected commit into the commit below it. The selected commit's message will be appended to the commit below it.", NoCommitsThisBranch: "No commits for this branch", UpdateRefHere: "Update branch '{{.ref}}' here", + ExecCommandHere: "Execute the following command here:", CannotSquashOrFixupFirstCommit: "There's no commit below to squash into", Fixup: "Fixup", SureFixupThisCommit: "Are you sure you want to 'fixup' the selected commit(s) into the commit below?", diff --git a/pkg/integration/tests/interactive_rebase/show_exec_todos.go b/pkg/integration/tests/interactive_rebase/show_exec_todos.go new file mode 100644 index 000000000..bf10737e4 --- /dev/null +++ b/pkg/integration/tests/interactive_rebase/show_exec_todos.go @@ -0,0 +1,57 @@ +package interactive_rebase + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var ShowExecTodos = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Show exec todos in the rebase todo list", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(cfg *config.AppConfig) { + cfg.UserConfig.CustomCommands = []config.CustomCommand{ + { + Key: "X", + Context: "commits", + Command: "git -c core.editor=: rebase -i -x false HEAD^^", + }, + } + }, + SetupRepo: func(shell *Shell) { + shell. + NewBranch("branch1"). + CreateNCommits(3) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Press("X"). + Tap(func() { + t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Rebasing (2/4)Executing: false")).Confirm() + }). + Lines( + Contains("exec").Contains("false"), + Contains("pick").Contains("CI commit 03"), + Contains("CI ◯ <-- YOU ARE HERE --- commit 02"), + Contains("CI ◯ commit 01"), + ). + Tap(func() { + t.Common().ContinueRebase() + t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Rebasing (4/4)Executing: false")).Confirm() + }). + Lines( + Contains("CI ◯ <-- YOU ARE HERE --- commit 03"), + Contains("CI ◯ commit 02"), + Contains("CI ◯ commit 01"), + ). + Tap(func() { + t.Common().ContinueRebase() + }). + Lines( + Contains("CI ◯ commit 03"), + Contains("CI ◯ commit 02"), + Contains("CI ◯ commit 01"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index ea2b93f45..5fbbfb4e2 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -209,6 +209,7 @@ var tests = []*components.IntegrationTest{ interactive_rebase.RewordLastCommit, interactive_rebase.RewordYouAreHereCommit, interactive_rebase.RewordYouAreHereCommitWithEditor, + interactive_rebase.ShowExecTodos, interactive_rebase.SquashDownFirstCommit, interactive_rebase.SquashDownSecondCommit, interactive_rebase.SquashFixupsAbove, |