summaryrefslogtreecommitdiffstats
path: root/pkg/gui/patch_options_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-23 11:23:32 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commitbd661629720d38d10a06fab254266ec2968e3f0a (patch)
tree0fe7012373ffa5efb1934c73921909e26ffb3cee /pkg/gui/patch_options_panel.go
parent5cdfd41dca3ee2c080e8f3d40cfdc147e0b8a595 (diff)
fix up patch manager
Diffstat (limited to 'pkg/gui/patch_options_panel.go')
-rw-r--r--pkg/gui/patch_options_panel.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go
index 1eb6cffa7..d2e1ba072 100644
--- a/pkg/gui/patch_options_panel.go
+++ b/pkg/gui/patch_options_panel.go
@@ -26,7 +26,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
},
}
- if gui.GitCommand.PatchManager.CanRebase {
+ if gui.GitCommand.PatchManager.CanRebase && gui.workingTreeState() == "normal" {
menuItems = append(menuItems, []*menuItem{
{
displayString: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.PatchManager.To),
@@ -77,9 +77,6 @@ func (gui *Gui) validateNormalWorkingTreeState() (bool, error) {
if gui.GitCommand.WorkingTreeState() != "normal" {
return false, gui.createErrorPanel(gui.Tr.SLocalize("CantPatchWhileRebasingError"))
}
- if gui.GitCommand.WorkingTreeState() != "normal" {
- return false, gui.createErrorPanel(gui.Tr.SLocalize("CantPatchWhileRebasingError"))
- }
return true, nil
}
@@ -183,5 +180,10 @@ func (gui *Gui) handleApplyPatch(reverse bool) error {
func (gui *Gui) handleResetPatch() error {
gui.GitCommand.PatchManager.Reset()
+ if gui.currentContextKeyIgnoringPopups() == MAIN_PATCH_BUILDING_CONTEXT_KEY {
+ if err := gui.switchContext(gui.Contexts.CommitFiles.Context); err != nil {
+ return err
+ }
+ }
return gui.refreshCommitFilesView()
}