Hard restore with X drops staged pins at every depth

X restores the selection to the committed pins without the staged or
committed question, and resets every restored repository's index to
HEAD, so staged pins below are dropped too. Dropped staged pins alone
don't make it ask; they are listed if something else is lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 22:58:08 +02:00
co-authored by Claude Opus 5.5
parent fbd233f58d
commit 72500353cd
14 changed files with 250 additions and 44 deletions
+4 -2
View File
@@ -10,6 +10,7 @@ type keyMap struct {
Home, End, PageUp, PageDown key.Binding
Fetch, Reload, Filter, Issues key.Binding
Copy, Restore, Switch, Update key.Binding
HardRestore key.Binding
Help, Quit, QuitUpdate key.Binding
}
@@ -31,6 +32,7 @@ func defaultKeys() keyMap {
Filter: key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "filter")),
Issues: key.NewBinding(key.WithKeys("!"), key.WithHelp("!", "problems only")),
Restore: key.NewBinding(key.WithKeys("x"), key.WithHelp("x", "restore")),
HardRestore: key.NewBinding(key.WithKeys("X"), key.WithHelp("X", "hard restore")),
Switch: key.NewBinding(key.WithKeys("b"), key.WithHelp("b", "switch branch")),
Update: key.NewBinding(key.WithKeys("u"), key.WithHelp("u", "update pin")),
Copy: key.NewBinding(key.WithKeys("c"), key.WithHelp("c", "copy path")),
@@ -58,7 +60,7 @@ func (k keyMap) Navigation() []key.Binding {
// Submodule returns the bindings that act on the selected submodule. They
// are shown in the detail pane, or in the footer if the pane can't show them.
func (k keyMap) Submodule() []key.Binding {
return []key.Binding{k.Copy, k.Update, k.Switch, k.Restore}
return []key.Binding{k.Copy, k.Update, k.Switch, k.Restore, k.HardRestore}
}
// Global returns the bindings that don't depend on the selection.
@@ -90,7 +92,7 @@ func (k keyMap) FullHelp() [][]key.Binding {
{k.Up, k.Down, k.Left, k.Right, k.Toggle},
{k.CollapseAll, k.ExpandAll},
{k.Home, k.End, k.PageUp, k.PageDown},
{k.Copy, k.Update, k.Switch, k.Restore},
{k.Copy, k.Update, k.Switch, k.Restore, k.HardRestore},
{k.Fetch, k.Reload, k.Filter, k.Issues},
append([]key.Binding{k.Help, k.Quit}, k.fullUpdate()...),
}