summaryrefslogtreecommitdiffstats
path: root/pkg/gui/reflog_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-21 12:40:56 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-25 09:39:04 +1100
commit65917272a2f5e7b8ad32f56ec98ddf5a0b51710a (patch)
treef89e7740158d292caa95910122d2b6b0e3f25ef6 /pkg/gui/reflog_panel.go
parent137fd80fdbcdeabd9e37732b9c8fa34f3052f1eb (diff)
undoing status
Diffstat (limited to 'pkg/gui/reflog_panel.go')
-rw-r--r--pkg/gui/reflog_panel.go44
1 files changed, 24 insertions, 20 deletions
diff --git a/pkg/gui/reflog_panel.go b/pkg/gui/reflog_panel.go
index 4bdfddb54..3da4caeb1 100644
--- a/pkg/gui/reflog_panel.go
+++ b/pkg/gui/reflog_panel.go
@@ -85,7 +85,7 @@ func (gui *Gui) handleCheckoutReflogCommit(g *gocui.Gui, v *gocui.View) error {
}
err := gui.createConfirmationPanel(g, gui.getCommitsView(), true, gui.Tr.SLocalize("checkoutCommit"), gui.Tr.SLocalize("SureCheckoutThisCommit"), func(g *gocui.Gui, v *gocui.View) error {
- return gui.handleCheckoutRef(commit.Sha, nil)
+ return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{})
}, nil)
if err != nil {
return err
@@ -137,7 +137,7 @@ func (gui *Gui) reflogUndo(g *gocui.Gui, v *gocui.View) error {
if len(match) <= 1 {
return false, nil
}
- return true, gui.handleCheckoutRef(match[1], onDone)
+ return true, gui.handleCheckoutRef(match[1], handleCheckoutRefOptions{onDone: onDone, waitingStatus: gui.Tr.SLocalize("UndoingStatus")})
},
},
{
@@ -198,27 +198,31 @@ func (gui *Gui) handleHardResetWithAutoStash(commitSha string, onDone func()) er
if dirtyWorkingTree {
// offer to autostash changes
return gui.createConfirmationPanel(gui.g, gui.getBranchesView(), true, gui.Tr.SLocalize("AutoStashTitle"), gui.Tr.SLocalize("AutoStashPrompt"), func(g *gocui.Gui, v *gocui.View) error {
- if err := gui.GitCommand.StashSave(gui.Tr.SLocalize("StashPrefix") + commitSha); err != nil {
- return gui.createErrorPanel(g, err.Error())
- }
- if err := gui.resetToRef(commitSha, "hard"); err != nil {
- return gui.createErrorPanel(g, err.Error())
- }
- onDone()
+ return gui.WithWaitingStatus(gui.Tr.SLocalize("UndoingStatus"), func() error {
+ if err := gui.GitCommand.StashSave(gui.Tr.SLocalize("StashPrefix") + commitSha); err != nil {
+ return gui.createErrorPanel(g, err.Error())
+ }
+ if err := gui.resetToRef(commitSha, "hard"); err != nil {
+ return gui.createErrorPanel(g, err.Error())
+ }
+ onDone()
- if err := gui.GitCommand.StashDo(0, "pop"); err != nil {
- if err := gui.refreshSidePanels(g); err != nil {
- return err
+ if err := gui.GitCommand.StashDo(0, "pop"); err != nil {
+ if err := gui.refreshSidePanels(g); err != nil {
+ return err
+ }
+ return gui.createErrorPanel(g, err.Error())
}
- return gui.createErrorPanel(g, err.Error())
- }
- return gui.refreshSidePanels(g)
+ return gui.refreshSidePanels(g)
+ })
}, nil)
}
- if err := gui.resetToRef(commitSha, "hard"); err != nil {
- return gui.createErrorPanel(gui.g, err.Error())
- }
- onDone()
- return gui.refreshSidePanels(gui.g)
+ return gui.WithWaitingStatus(gui.Tr.SLocalize("UndoingStatus"), func() error {
+ if err := gui.resetToRef(commitSha, "hard"); err != nil {
+ return gui.createErrorPanel(gui.g, err.Error())
+ }
+ onDone()
+ return gui.refreshSidePanels(gui.g)
+ })
}