mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Add confirmation for hard reset when there are uncommitted changes
This commit is contained in:
@ -248,8 +248,15 @@ func (self *RefsHelper) CreateGitResetMenu(name string, ref string) error {
|
||||
style.FgRed.Sprintf("reset --%s %s", row.strength, name),
|
||||
},
|
||||
OnPress: func() error {
|
||||
self.c.LogAction("Reset")
|
||||
return self.ResetToRef(ref, row.strength, []string{})
|
||||
return self.c.ConfirmIf(row.strength == "hard" && IsWorkingTreeDirty(self.c.Model().Files),
|
||||
types.ConfirmOpts{
|
||||
Title: self.c.Tr.Actions.HardReset,
|
||||
Prompt: self.c.Tr.ResetHardConfirmation,
|
||||
HandleConfirm: func() error {
|
||||
self.c.LogAction("Reset")
|
||||
return self.ResetToRef(ref, row.strength, []string{})
|
||||
},
|
||||
})
|
||||
},
|
||||
Key: row.key,
|
||||
Tooltip: row.tooltip,
|
||||
|
Reference in New Issue
Block a user