mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Check if there is any commit to amend and use 'A' instead of 'M' as shortcut.
This commit is contained in:
@ -317,9 +317,9 @@ func (c *GitCommand) usingGpg() bool {
|
|||||||
func (c *GitCommand) Commit(message string, amend bool) (*exec.Cmd, error) {
|
func (c *GitCommand) Commit(message string, amend bool) (*exec.Cmd, error) {
|
||||||
amendParam := ""
|
amendParam := ""
|
||||||
if amend {
|
if amend {
|
||||||
amendParam = "--amend "
|
amendParam = "--amend"
|
||||||
}
|
}
|
||||||
command := fmt.Sprintf("git commit %s-m %s", amendParam, c.OSCommand.Quote(message))
|
command := fmt.Sprintf("git commit %s -m %s", amendParam, c.OSCommand.Quote(message))
|
||||||
if c.usingGpg() {
|
if c.usingGpg() {
|
||||||
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil
|
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil
|
||||||
}
|
}
|
||||||
|
@ -217,6 +217,11 @@ func (gui *Gui) handleAmendCommitPress(g *gocui.Gui, filesView *gocui.View) erro
|
|||||||
}
|
}
|
||||||
title := strings.Title(gui.Tr.SLocalize("AmendLastCommit"))
|
title := strings.Title(gui.Tr.SLocalize("AmendLastCommit"))
|
||||||
question := gui.Tr.SLocalize("SureToAmend")
|
question := gui.Tr.SLocalize("SureToAmend")
|
||||||
|
|
||||||
|
if len(gui.State.Commits) == 0 {
|
||||||
|
return gui.createErrorPanel(g, gui.Tr.SLocalize("NoCommitToAmend"))
|
||||||
|
}
|
||||||
|
|
||||||
return gui.createConfirmationPanel(g, filesView, title, question, func(g *gocui.Gui, v *gocui.View) error {
|
return gui.createConfirmationPanel(g, filesView, title, question, func(g *gocui.Gui, v *gocui.View) error {
|
||||||
lastCommitMsg := gui.State.Commits[0].Name
|
lastCommitMsg := gui.State.Commits[0].Name
|
||||||
_, err := gui.GitCommand.Commit(lastCommitMsg, true)
|
_, err := gui.GitCommand.Commit(lastCommitMsg, true)
|
||||||
|
@ -127,7 +127,7 @@ func (gui *Gui) GetKeybindings() []*Binding {
|
|||||||
Description: gui.Tr.SLocalize("CommitChanges"),
|
Description: gui.Tr.SLocalize("CommitChanges"),
|
||||||
}, {
|
}, {
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Key: 'M',
|
Key: 'A',
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleAmendCommitPress,
|
Handler: gui.handleAmendCommitPress,
|
||||||
Description: gui.Tr.SLocalize("AmendLastCommit"),
|
Description: gui.Tr.SLocalize("AmendLastCommit"),
|
||||||
@ -188,7 +188,7 @@ func (gui *Gui) GetKeybindings() []*Binding {
|
|||||||
Description: gui.Tr.SLocalize("stashFiles"),
|
Description: gui.Tr.SLocalize("stashFiles"),
|
||||||
}, {
|
}, {
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Key: 'A',
|
Key: 'M',
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleAbortMerge,
|
Handler: gui.handleAbortMerge,
|
||||||
Description: gui.Tr.SLocalize("abortMerge"),
|
Description: gui.Tr.SLocalize("abortMerge"),
|
||||||
|
@ -40,6 +40,9 @@ func addDutch(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureToAmend",
|
ID: "SureToAmend",
|
||||||
Other: "Weet je zeker dat je de laatste commit wilt wijzigen? U kunt het commit-bericht wijzigen vanuit het commits-paneel.",
|
Other: "Weet je zeker dat je de laatste commit wilt wijzigen? U kunt het commit-bericht wijzigen vanuit het commits-paneel.",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "NoCommitToAmend",
|
||||||
|
Other: "Er is geen verplichting om te wijzigen.",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CommitChangesWithEditor",
|
ID: "CommitChangesWithEditor",
|
||||||
Other: "commit Veranderingen met de git editor",
|
Other: "commit Veranderingen met de git editor",
|
||||||
|
@ -48,6 +48,9 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureToAmend",
|
ID: "SureToAmend",
|
||||||
Other: "Are you sure you want to amend last commit? You can change commit message from commits panel.",
|
Other: "Are you sure you want to amend last commit? You can change commit message from commits panel.",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "NoCommitToAmend",
|
||||||
|
Other: "There's no commit to amend.",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CommitChangesWithEditor",
|
ID: "CommitChangesWithEditor",
|
||||||
Other: "commit changes using git editor",
|
Other: "commit changes using git editor",
|
||||||
|
@ -38,6 +38,9 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureToAmend",
|
ID: "SureToAmend",
|
||||||
Other: "Czy na pewno chcesz zmienić ostatnie zatwierdzenie? Możesz zmienić komunikat zatwierdzenia z panelu zatwierdzeń.",
|
Other: "Czy na pewno chcesz zmienić ostatnie zatwierdzenie? Możesz zmienić komunikat zatwierdzenia z panelu zatwierdzeń.",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "NoCommitToAmend",
|
||||||
|
Other: "Nie ma zobowiązania do zmiany.",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CommitChangesWithEditor",
|
ID: "CommitChangesWithEditor",
|
||||||
Other: "commituj zmiany używając edytora z gita",
|
Other: "commituj zmiany używając edytora z gita",
|
||||||
|
Reference in New Issue
Block a user