From 6e80371535d13b455eb5cdf35adab810aa828a04 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 29 Sep 2020 18:16:40 +1000 Subject: [PATCH] tell users we're going to reset submodules --- pkg/gui/workspace_reset_options_panel.go | 9 ++++++++- pkg/i18n/english.go | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/gui/workspace_reset_options_panel.go b/pkg/gui/workspace_reset_options_panel.go index 0899b5c98..93b33f56e 100644 --- a/pkg/gui/workspace_reset_options_panel.go +++ b/pkg/gui/workspace_reset_options_panel.go @@ -1,6 +1,8 @@ package gui import ( + "fmt" + "github.com/fatih/color" "github.com/jesseduffield/gocui" ) @@ -8,11 +10,16 @@ import ( func (gui *Gui) handleCreateResetMenu(g *gocui.Gui, v *gocui.View) error { 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{ { displayStrings: []string{ gui.Tr.SLocalize("discardAllChangesToAllFiles"), - red.Sprint("reset --hard HEAD && git clean -fd"), + red.Sprint(nukeStr), }, onPress: func() error { if err := gui.GitCommand.ResetAndClean(); err != nil { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index f34e74748..afce1cffd 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1194,6 +1194,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "submoduleStashAndReset", Other: "stash uncommitted submodule changes and reset", + }, &i18n.Message{ + ID: "andResetSubmodules", + Other: "and reset submodules", }, ) }