mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 21:05:48 +02:00
clean as well as reset (I'm hoping this is a good design decision)
This commit is contained in:
parent
66512ca253
commit
3b51d7cd00
6 changed files with 16 additions and 12 deletions
|
@ -208,9 +208,13 @@ func includesInt(list []int, a int) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetHard clears the working tree to match HEAD
|
// ResetAndClean removes all unstaged changes and removes all untracked files
|
||||||
func (c *GitCommand) ResetHard() error {
|
func (c *GitCommand) ResetAndClean() error {
|
||||||
return c.OSCommand.RunCommand("git reset --hard HEAD")
|
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
|
// UpstreamDifferenceCount checks how many pushables/pullables there are for the
|
||||||
|
|
|
@ -433,9 +433,9 @@ func (gui *Gui) handleAbortMerge(g *gocui.Gui, v *gocui.View) error {
|
||||||
return gui.refreshFiles(g)
|
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 {
|
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())
|
gui.createErrorPanel(g, err.Error())
|
||||||
}
|
}
|
||||||
return gui.refreshFiles(g)
|
return gui.refreshFiles(g)
|
||||||
|
|
|
@ -210,7 +210,7 @@ func (gui *Gui) GetKeybindings() []*Binding {
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Key: 'D',
|
Key: 'D',
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleResetHard,
|
Handler: gui.handleResetAndClean,
|
||||||
Description: gui.Tr.SLocalize("resetHard"),
|
Description: gui.Tr.SLocalize("resetHard"),
|
||||||
}, {
|
}, {
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
|
|
|
@ -138,7 +138,7 @@ func addDutch(i18nObject *i18n.Bundle) error {
|
||||||
Other: "Dit bestand heeft geen merge conflicten",
|
Other: "Dit bestand heeft geen merge conflicten",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureResetHardHead",
|
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{
|
}, &i18n.Message{
|
||||||
ID: "SureTo",
|
ID: "SureTo",
|
||||||
Other: "Weet je het zeker dat je {{.fileName}} wilt {{.deleteVerb}} (je veranderingen zullen worden verwijderd)",
|
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`,
|
Other: `refresh bestanden`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "resetHard",
|
ID: "resetHard",
|
||||||
Other: `harde reset`,
|
Other: `harde reset and verwijderen ongevolgde bestanden`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "mergeIntoCurrentBranch",
|
ID: "mergeIntoCurrentBranch",
|
||||||
Other: `merge in met huidige checked out branch`,
|
Other: `merge in met huidige checked out branch`,
|
||||||
|
|
|
@ -146,7 +146,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
||||||
Other: "This file has no merge conflicts",
|
Other: "This file has no merge conflicts",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureResetHardHead",
|
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{
|
}, &i18n.Message{
|
||||||
ID: "SureTo",
|
ID: "SureTo",
|
||||||
Other: "Are you sure you want to {{.deleteVerb}} {{.fileName}} (you will lose your changes)?",
|
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`,
|
Other: `refresh files`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "resetHard",
|
ID: "resetHard",
|
||||||
Other: `reset hard`,
|
Other: `reset hard and remove untracked files`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "mergeIntoCurrentBranch",
|
ID: "mergeIntoCurrentBranch",
|
||||||
Other: `merge into currently checked out branch`,
|
Other: `merge into currently checked out branch`,
|
||||||
|
|
|
@ -127,7 +127,7 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
||||||
Other: "Ten plik nie powoduje konfliktów scalania",
|
Other: "Ten plik nie powoduje konfliktów scalania",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureResetHardHead",
|
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{
|
}, &i18n.Message{
|
||||||
ID: "SureTo",
|
ID: "SureTo",
|
||||||
Other: "Jesteś pewny, że chcesz {{.deleteVerb}} {{.fileName}} (stracisz swoje wprowadzone zmiany)?",
|
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`,
|
Other: `odśwież pliki`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "resetHard",
|
ID: "resetHard",
|
||||||
Other: `zresetuj twardo`,
|
Other: `zresetuj twardo i usuń niepotwierdzone pliki`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "mergeIntoCurrentBranch",
|
ID: "mergeIntoCurrentBranch",
|
||||||
Other: `scal do obecnej gałęzi`,
|
Other: `scal do obecnej gałęzi`,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue