From 58bdcbf1dd9dde9d18eea885d62f41d1ba469617 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 24 Jan 2022 19:03:29 +1100 Subject: [PATCH] always refresh after stash action --- pkg/gui/stash_panel.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go index 9b6760b7a..617642497 100644 --- a/pkg/gui/stash_panel.go +++ b/pkg/gui/stash_panel.go @@ -51,10 +51,12 @@ func (gui *Gui) handleStashApply() error { apply := func() error { gui.logAction(gui.Tr.Actions.Stash) - if err := gui.Git.Stash.Apply(stashEntry.Index); err != nil { + err := gui.Git.Stash.Apply(stashEntry.Index) + _ = gui.postStashRefresh() + if err != nil { return gui.surfaceError(err) } - return gui.postStashRefresh() + return nil } if skipStashWarning { @@ -80,10 +82,12 @@ func (gui *Gui) handleStashPop() error { pop := func() error { gui.logAction(gui.Tr.Actions.Stash) - if err := gui.Git.Stash.Pop(stashEntry.Index); err != nil { + err := gui.Git.Stash.Pop(stashEntry.Index) + _ = gui.postStashRefresh() + if err != nil { return gui.surfaceError(err) } - return gui.postStashRefresh() + return nil } if skipStashWarning { @@ -110,10 +114,12 @@ func (gui *Gui) handleStashDrop() error { prompt: gui.Tr.SureDropStashEntry, handleConfirm: func() error { gui.logAction(gui.Tr.Actions.Stash) - if err := gui.Git.Stash.Drop(stashEntry.Index); err != nil { + err := gui.Git.Stash.Drop(stashEntry.Index) + _ = gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{STASH}}) + if err != nil { return gui.surfaceError(err) } - return gui.postStashRefresh() + return nil }, }) } @@ -130,10 +136,12 @@ func (gui *Gui) handleStashSave(stashFunc func(message string) error) error { return gui.prompt(promptOpts{ title: gui.Tr.StashChanges, handleConfirm: func(stashComment string) error { - if err := stashFunc(stashComment); err != nil { + err := stashFunc(stashComment) + _ = gui.postStashRefresh() + if err != nil { return gui.surfaceError(err) } - return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{STASH, FILES}}) + return nil }, }) }