diff options
-rw-r--r-- | pkg/gui/commit_message_panel.go | 3 | ||||
-rw-r--r-- | pkg/gui/files_panel.go | 30 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 3 | ||||
-rw-r--r-- | pkg/i18n/dutch.go | 5 | ||||
-rw-r--r-- | pkg/i18n/english.go | 5 | ||||
-rw-r--r-- | pkg/i18n/polish.go | 5 |
6 files changed, 24 insertions, 27 deletions
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index 93a3e1503..c26b5573a 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -12,8 +12,7 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error { if message == "" { return gui.createErrorPanel(g, gui.Tr.SLocalize("CommitWithoutMessageErr")) } - amendCommit := v.Title == gui.Tr.SLocalize("AmendLastCommit") - sub, err := gui.GitCommand.Commit(message, amendCommit) + sub, err := gui.GitCommand.Commit(message, false) if err != nil { // TODO need to find a way to send through this error if err != gui.Errors.ErrSubProcess { diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index c0d01136a..d76ba5791 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -201,14 +201,7 @@ func (gui *Gui) handleCommitPress(g *gocui.Gui, filesView *gocui.View) error { if len(gui.stagedFiles()) == 0 && !gui.State.HasMergeConflicts { return gui.createErrorPanel(g, gui.Tr.SLocalize("NoStagedFilesToCommit")) } - commitMessageView := gui.getCommitMessageView(g) - if commitMessageView.Title == gui.Tr.SLocalize("AmendLastCommit") { - commitMessageView.Clear() - commitMessageView.SetCursor(0, 0) - } - - commitMessageView.Title = gui.Tr.SLocalize("CommitMessage") g.Update(func(g *gocui.Gui) error { g.SetViewOnTop("commitMessage") gui.switchFocus(g, filesView, commitMessageView) @@ -222,20 +215,17 @@ func (gui *Gui) handleAmendCommitPress(g *gocui.Gui, filesView *gocui.View) erro if len(gui.stagedFiles()) == 0 && !gui.State.HasMergeConflicts { return gui.createErrorPanel(g, gui.Tr.SLocalize("NoStagedFilesToCommit")) } - commitMessageView := gui.getCommitMessageView(g) - commitMessageView.Clear() - commitMessageView.Title = gui.Tr.SLocalize("AmendLastCommit") + title := strings.Title(gui.Tr.SLocalize("AmendLastCommit")) + question := gui.Tr.SLocalize("SureToAmend") + return gui.createConfirmationPanel(g, filesView, title, question, func(g *gocui.Gui, v *gocui.View) error { + lastCommitMsg := gui.State.Commits[0].Name + _, err := gui.GitCommand.Commit(lastCommitMsg, true) + if err != nil { + gui.createErrorPanel(g, err.Error()) + } - g.Update(func(g *gocui.Gui) error { - g.SetViewOnTop("commitMessage") - gui.switchFocus(g, filesView, commitMessageView) - lastCommitName := gui.State.Commits[0].Name - commitMessageView.Write([]byte(lastCommitName)) - commitMessageView.SetCursor(len(lastCommitName), 0) - gui.RenderCommitLength() - return nil - }) - return nil + return gui.refreshFiles(g) + }, nil) } // handleCommitEditorPress - handle when the user wants to commit changes via diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 44df7b686..b242028c6 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -2,7 +2,6 @@ package gui import ( "github.com/jesseduffield/gocui" - "strings" ) // Binding - a keybinding mapping a key and modifier to a handler. The keypress @@ -131,7 +130,7 @@ func (gui *Gui) GetKeybindings() []*Binding { Key: 'M', Modifier: gocui.ModNone, Handler: gui.handleAmendCommitPress, - Description: strings.ToLower(gui.Tr.SLocalize("AmendLastCommit")), + Description: gui.Tr.SLocalize("AmendLastCommit"), }, { ViewName: "files", Key: 'C', diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index ef10625d5..56e93fdc6 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -36,7 +36,10 @@ func addDutch(i18nObject *i18n.Bundle) error { Other: "Commit Veranderingen", }, &i18n.Message{ ID: "AmendLastCommit", - Other: "Wijzig laatste commit", + Other: "wijzig laatste commit", + }, &i18n.Message{ + ID: "SureToAmend", + Other: "Weet je zeker dat je de laatste commit wilt wijzigen? U kunt het commit-bericht wijzigen vanuit het commits-paneel.", }, &i18n.Message{ ID: "CommitChangesWithEditor", Other: "commit Veranderingen met de git editor", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index bfa1de83e..41ce71bd2 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -44,7 +44,10 @@ func addEnglish(i18nObject *i18n.Bundle) error { Other: "commit changes", }, &i18n.Message{ ID: "AmendLastCommit", - Other: "Amend last commit", + Other: "amend last commit", + }, &i18n.Message{ + ID: "SureToAmend", + Other: "Are you sure you want to amend last commit? You can change commit message from commits panel.", }, &i18n.Message{ ID: "CommitChangesWithEditor", Other: "commit changes using git editor", diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index d4f204a3f..74b4106a5 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -34,7 +34,10 @@ func addPolish(i18nObject *i18n.Bundle) error { Other: "commituj zmiany", }, &i18n.Message{ ID: "AmendLastCommit", - Other: "Zmień ostatnie zatwierdzenie", + Other: "zmień ostatnie zatwierdzenie", + }, &i18n.Message{ + ID: "SureToAmend", + Other: "Czy na pewno chcesz zmienić ostatnie zatwierdzenie? Możesz zmienić komunikat zatwierdzenia z panelu zatwierdzeń.", }, &i18n.Message{ ID: "CommitChangesWithEditor", Other: "commituj zmiany używając edytora z gita", |