1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-01 13:17:53 +02:00

tell users we're going to reset submodules

This commit is contained in:
Jesse Duffield 2020-09-29 18:16:40 +10:00
parent b4a350259d
commit 6e80371535
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package gui package gui
import ( import (
"fmt"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
) )
@ -8,11 +10,16 @@ import (
func (gui *Gui) handleCreateResetMenu(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleCreateResetMenu(g *gocui.Gui, v *gocui.View) error {
red := color.New(color.FgRed) red := color.New(color.FgRed)
nukeStr := "reset --hard HEAD && git clean -fd"
if len(gui.State.SubmoduleConfigs) > 0 {
nukeStr = fmt.Sprintf("%s (%s)", nukeStr, gui.Tr.SLocalize("andResetSubmodules"))
}
menuItems := []*menuItem{ menuItems := []*menuItem{
{ {
displayStrings: []string{ displayStrings: []string{
gui.Tr.SLocalize("discardAllChangesToAllFiles"), gui.Tr.SLocalize("discardAllChangesToAllFiles"),
red.Sprint("reset --hard HEAD && git clean -fd"), red.Sprint(nukeStr),
}, },
onPress: func() error { onPress: func() error {
if err := gui.GitCommand.ResetAndClean(); err != nil { if err := gui.GitCommand.ResetAndClean(); err != nil {

View File

@ -1194,6 +1194,9 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{ }, &i18n.Message{
ID: "submoduleStashAndReset", ID: "submoduleStashAndReset",
Other: "stash uncommitted submodule changes and reset", Other: "stash uncommitted submodule changes and reset",
}, &i18n.Message{
ID: "andResetSubmodules",
Other: "and reset submodules",
}, },
) )
} }