diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 13:36:07 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 14:14:47 +1100 |
commit | 0dfd02c42d1e51200c915f0c86aee55c1945cff0 (patch) | |
tree | 19b192083cf97a6d288f705b856d5adc8f3803b7 /pkg/gui | |
parent | ee15202207a739e1154c28f4385cf9a9014fa064 (diff) |
allow rewording old commits
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/commits_panel.go | 10 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index fcc49d839..b933dc5c8 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -221,10 +221,6 @@ func (gui *Gui) handleRewordCommit() error { return nil } - if gui.State.Panels.Commits.SelectedLineIdx != 0 { - return gui.createErrorPanel(gui.Tr.OnlyRewordTopCommit) - } - commit := gui.getSelectedLocalCommit() if commit == nil { return nil @@ -240,7 +236,7 @@ func (gui *Gui) handleRewordCommit() error { initialContent: message, handleConfirm: func(response string) error { gui.logAction(gui.Tr.Actions.RewordCommit) - if err := gui.Git.Commit.RewordLastCommit(response); err != nil { + if err := gui.Git.Rebase.RewordCommit(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, response); err != nil { return gui.surfaceError(err) } @@ -249,7 +245,7 @@ func (gui *Gui) handleRewordCommit() error { }) } -func (gui *Gui) handleRenameCommitEditor() error { +func (gui *Gui) handleRewordCommitEditor() error { if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { return err } @@ -263,7 +259,7 @@ func (gui *Gui) handleRenameCommitEditor() error { } gui.logAction(gui.Tr.Actions.RewordCommit) - subProcess, err := gui.Git.Rebase.RewordCommit(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx) + subProcess, err := gui.Git.Rebase.RewordCommitInEditor(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx) if err != nil { return gui.surfaceError(err) } diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 896349dae..a3e998416 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -750,7 +750,7 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { ViewName: "commits", Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)}, Key: gui.getKey(config.Commits.RenameCommitWithEditor), - Handler: gui.handleRenameCommitEditor, + Handler: gui.handleRewordCommitEditor, Description: gui.Tr.LcRenameCommitEditor, }, { |