Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions pkg/gui/controllers/workspace_reset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,26 @@ func (self *FilesController) createResetMenu() error {
red.Sprint(nukeStr),
},
OnPress: func() error {
self.c.LogAction(self.c.Tr.Actions.NukeWorkingTree)
if err := self.c.Git().WorkingTree.ResetAndClean(); err != nil {
return err
}
self.c.Confirm(
types.ConfirmOpts{
Title: self.c.Tr.Actions.NukeWorkingTree,
Prompt: self.c.Tr.NukeTreeConfirmation,
HandleConfirm: func() error {
self.c.LogAction(self.c.Tr.Actions.NukeWorkingTree)
if err := self.c.Git().WorkingTree.ResetAndClean(); err != nil {
return err
}

if self.c.UserConfig().Gui.AnimateExplosion {
self.animateExplosion()
}
if self.c.UserConfig().Gui.AnimateExplosion {
self.animateExplosion()
}

self.c.Refresh(
types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}},
)
self.c.Refresh(
types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}},
)
return nil
},
})
return nil
},
Key: 'x',
Expand Down
2 changes: 2 additions & 0 deletions pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ type TranslationSet struct {
SoftResetPrompt string
UpstreamGone string
NukeDescription string
NukeTreeConfirmation string
DiscardStagedChangesDescription string
EmptyOutput string
Patch string
Expand Down Expand Up @@ -1832,6 +1833,7 @@ func EnglishTranslationSet() *TranslationSet {
CheckoutAutostashPrompt: "Are you sure you want to checkout '%s'? An auto-stash will be performed if necessary.",
UpstreamGone: "(upstream gone)",
NukeDescription: "If you want to make all the changes in the worktree go away, this is the way to do it. If there are dirty submodule changes this will stash those changes in the submodule(s).",
NukeTreeConfirmation: "Are you sure you want to nuke the working tree? This will discard all changes in the worktree (staged, unstaged and untracked), which is not undoable.",
DiscardStagedChangesDescription: "This will create a new stash entry containing only staged files and then drop it, so that the working tree is left with only unstaged changes",
EmptyOutput: "<Empty output>",
Patch: "Patch",
Expand Down