summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-03-23 23:37:15 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-23 23:43:21 +1100
commit12ecd665c8f69e45e00629b05c2b3af72f3e3b51 (patch)
treeb71d651e162f2ecc88d294228d62fd5d32ee110e /pkg
parentcc5d13c833daaba4a27507ce33e5de90ed8b1567 (diff)
safe reword
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/controllers/local_commits_controller.go28
-rw-r--r--pkg/i18n/english.go5
2 files changed, 22 insertions, 11 deletions
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go
index d45e3ed56..45c65e7ee 100644
--- a/pkg/gui/controllers/local_commits_controller.go
+++ b/pkg/gui/controllers/local_commits_controller.go
@@ -267,18 +267,24 @@ func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error {
return nil
}
- self.c.LogAction(self.c.Tr.Actions.RewordCommit)
- subProcess, err := self.git.Rebase.RewordCommitInEditor(
- self.model.Commits, self.context().GetSelectedLineIdx(),
- )
- if err != nil {
- return self.c.Error(err)
- }
- if subProcess != nil {
- return self.c.RunSubprocessAndRefresh(subProcess)
- }
+ return self.c.Ask(types.AskOpts{
+ Title: self.c.Tr.RewordInEditorTitle,
+ Prompt: self.c.Tr.RewordInEditorPrompt,
+ HandleConfirm: func() error {
+ self.c.LogAction(self.c.Tr.Actions.RewordCommit)
+ subProcess, err := self.git.Rebase.RewordCommitInEditor(
+ self.model.Commits, self.context().GetSelectedLineIdx(),
+ )
+ if err != nil {
+ return self.c.Error(err)
+ }
+ if subProcess != nil {
+ return self.c.RunSubprocessAndRefresh(subProcess)
+ }
- return nil
+ return nil
+ },
+ })
}
func (self *LocalCommitsController) drop(commit *models.Commit) error {
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index db25cf0a6..c7965e6a9 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -454,6 +454,8 @@ type TranslationSet struct {
LcOpenCommitInBrowser string
LcViewBisectOptions string
ConfirmRevertCommit string
+ RewordInEditorTitle string
+ RewordInEditorPrompt string
Actions Actions
Bisect Bisect
}
@@ -1027,6 +1029,9 @@ func EnglishTranslationSet() TranslationSet {
LcOpenCommitInBrowser: "open commit in browser",
LcViewBisectOptions: "view bisect options",
ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}?",
+ RewordInEditorTitle: "Reword in editor",
+ RewordInEditorPrompt: "Are you sure you want to reword this commit in your editor?",
+
Actions: Actions{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
CheckoutCommit: "Checkout commit",