diff options
author | Jens Pfeifle <jens@pfeifle.tech> | 2022-04-22 16:01:30 +0200 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-05-08 13:29:56 +1000 |
commit | 7c573a5bea37cefd4ab036ac23d9dd45cd4059bd (patch) | |
tree | f1fe6f4dceeb1f14a7add963dacf0e969b4c4ef7 /pkg/gui/controllers | |
parent | 8247089e53e851a76147205d72766a264bb00a97 (diff) |
Add command to reset the commit author from the commits panel.
Diffstat (limited to 'pkg/gui/controllers')
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 022ff1fa3..7684d6469 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -122,6 +122,11 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ Description: self.c.Tr.LcAmendToCommit, }, { + Key: opts.GetKey(opts.Config.Commits.ResetCommitAuthor), + Handler: self.checkSelected(self.resetAuthor), + Description: self.c.Tr.LcResetCommitAuthor, + }, + { Key: opts.GetKey(opts.Config.Commits.RevertCommit), Handler: self.checkSelected(self.revert), Description: self.c.Tr.LcRevertCommit, @@ -418,6 +423,21 @@ func (self *LocalCommitsController) amendTo(commit *models.Commit) error { }) } +func (self *LocalCommitsController) resetAuthor(commit *models.Commit) error { + return self.c.Confirm(types.ConfirmOpts{ + Title: self.c.Tr.LcResetCommitAuthor, + Prompt: self.c.Tr.SureResetCommitAuthor, + HandleConfirm: func() error { + self.c.LogAction(self.c.Tr.Actions.ResetCommitAuthor) + if err := self.git.Rebase.ResetCommitAuthor(self.model.Commits, self.context().GetSelectedLineIdx()); err != nil { + return self.c.Error(err) + } + + return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) + }, + }) +} + func (self *LocalCommitsController) revert(commit *models.Commit) error { if commit.IsMerge() { return self.createRevertMergeCommitMenu(commit) |