summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-12-05 20:06:47 +1100
committerJesse Duffield <jessedduffield@gmail.com>2018-12-05 20:06:47 +1100
commit3b51d7cd0026f0b4da13bf6ffcd4635b86c2a704 (patch)
treec55e7c91b001ce0de5a545bbf09b361c5c46308a /pkg
parent66512ca253b73c173196080ea0929e49a521b379 (diff)
clean as well as reset (I'm hoping this is a good design decision)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/git.go10
-rw-r--r--pkg/gui/files_panel.go4
-rw-r--r--pkg/gui/keybindings.go2
-rw-r--r--pkg/i18n/dutch.go4
-rw-r--r--pkg/i18n/english.go4
-rw-r--r--pkg/i18n/polish.go4
6 files changed, 16 insertions, 12 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index e06b36d2e..7d820c599 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -208,9 +208,13 @@ func includesInt(list []int, a int) bool {
return false
}
-// ResetHard clears the working tree to match HEAD
-func (c *GitCommand) ResetHard() error {
- return c.OSCommand.RunCommand("git reset --hard HEAD")
+// ResetAndClean removes all unstaged changes and removes all untracked files
+func (c *GitCommand) ResetAndClean() error {
+ if err := c.OSCommand.RunCommand("git reset --hard HEAD"); err != nil {
+ return err
+ }
+
+ return c.OSCommand.RunCommand("git clean -fd")
}
// UpstreamDifferenceCount checks how many pushables/pullables there are for the
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index a16ef4909..5eb8f63f1 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -433,9 +433,9 @@ func (gui *Gui) handleAbortMerge(g *gocui.Gui, v *gocui.View) error {
return gui.refreshFiles(g)
}
-func (gui *Gui) handleResetHard(g *gocui.Gui, v *gocui.View) error {
+func (gui *Gui) handleResetAndClean(g *gocui.Gui, v *gocui.View) error {
return gui.createConfirmationPanel(g, v, gui.Tr.SLocalize("ClearFilePanel"), gui.Tr.SLocalize("SureResetHardHead"), func(g *gocui.Gui, v *gocui.View) error {
- if err := gui.GitCommand.ResetHard(); err != nil {
+ if err := gui.GitCommand.ResetAndClean(); err != nil {
gui.createErrorPanel(g, err.Error())
}
return gui.refreshFiles(g)
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index 4158bedb7..1a63d009c 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -210,7 +210,7 @@ func (gui *Gui) GetKeybindings() []*Binding {
ViewName: "files",
Key: 'D',
Modifier: gocui.ModNone,
- Handler: gui.handleResetHard,
+ Handler: gui.handleResetAndClean,
Description: gui.Tr.SLocalize("resetHard"),
}, {
ViewName: "files",
diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go
index f49457ec4..f63b83477 100644
--- a/pkg/i18n/dutch.go
+++ b/pkg/i18n/dutch.go
@@ -138,7 +138,7 @@ func addDutch(i18nObject *i18n.Bundle) error {
Other: "Dit bestand heeft geen merge conflicten",
}, &i18n.Message{
ID: "SureResetHardHead",
- Other: "Weet je het zeker dat je `reset --hard HEAD` wil uitvoeren? Het kan dat je hierdoor bestanden verliest",
+ Other: "Weet je het zeker dat je `reset --hard HEAD` en `clean -fd` wil uitvoeren? Het kan dat je hierdoor bestanden verliest",
}, &i18n.Message{
ID: "SureTo",
Other: "Weet je het zeker dat je {{.fileName}} wilt {{.deleteVerb}} (je veranderingen zullen worden verwijderd)",
@@ -384,7 +384,7 @@ func addDutch(i18nObject *i18n.Bundle) error {
Other: `refresh bestanden`,
}, &i18n.Message{
ID: "resetHard",
- Other: `harde reset`,
+ Other: `harde reset and verwijderen ongevolgde bestanden`,
}, &i18n.Message{
ID: "mergeIntoCurrentBranch",
Other: `merge in met huidige checked out branch`,
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index a3ce14d2e..97b6addf6 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -146,7 +146,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
Other: "This file has no merge conflicts",
}, &i18n.Message{
ID: "SureResetHardHead",
- Other: "Are you sure you want `reset --hard HEAD`? You may lose changes",
+ Other: "Are you sure you want `reset --hard HEAD` and `clean -fd`? You may lose changes",
}, &i18n.Message{
ID: "SureTo",
Other: "Are you sure you want to {{.deleteVerb}} {{.fileName}} (you will lose your changes)?",
@@ -392,7 +392,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
Other: `refresh files`,
}, &i18n.Message{
ID: "resetHard",
- Other: `reset hard`,
+ Other: `reset hard and remove untracked files`,
}, &i18n.Message{
ID: "mergeIntoCurrentBranch",
Other: `merge into currently checked out branch`,
diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go
index 3e1ce657d..52e110b37 100644
--- a/pkg/i18n/polish.go
+++ b/pkg/i18n/polish.go
@@ -127,7 +127,7 @@ func addPolish(i18nObject *i18n.Bundle) error {
Other: "Ten plik nie powoduje konfliktów scalania",
}, &i18n.Message{
ID: "SureResetHardHead",
- Other: "Jesteś pewny, że chcesz wykonać `reset --hard HEAD`? Możesz stracić wprowadzone zmiany",
+ Other: "Jesteś pewny, że chcesz wykonać `reset --hard HEAD` i `clean -fd`? Możesz stracić wprowadzone zmiany",
}, &i18n.Message{
ID: "SureTo",
Other: "Jesteś pewny, że chcesz {{.deleteVerb}} {{.fileName}} (stracisz swoje wprowadzone zmiany)?",
@@ -370,7 +370,7 @@ func addPolish(i18nObject *i18n.Bundle) error {
Other: `odśwież pliki`,
}, &i18n.Message{
ID: "resetHard",
- Other: `zresetuj twardo`,
+ Other: `zresetuj twardo i usuń niepotwierdzone pliki`,
}, &i18n.Message{
ID: "mergeIntoCurrentBranch",
Other: `scal do obecnej gałęzi`,