summaryrefslogtreecommitdiffstats
path: root/pkg/gui/patch_options_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-21 20:40:20 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commit1fd0f31682a1b55f22508309e6a16a3e56ac0206 (patch)
tree45e05092c0d91d40708256d300fa1e5e07ab1c68 /pkg/gui/patch_options_panel.go
parente6a1bd656620d2b786266b593b197721d669085a (diff)
only show rebasey commands on a local commit when patch building
Diffstat (limited to 'pkg/gui/patch_options_panel.go')
-rw-r--r--pkg/gui/patch_options_panel.go29
1 files changed, 19 insertions, 10 deletions
diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go
index 844ecbd36..2b6ec0c2a 100644
--- a/pkg/gui/patch_options_panel.go
+++ b/pkg/gui/patch_options_panel.go
@@ -13,16 +13,8 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
menuItems := []*menuItem{
{
- displayString: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.PatchManager.Parent),
- onPress: gui.handleDeletePatchFromCommit,
- },
- {
- displayString: "pull patch out into index",
- onPress: gui.handlePullPatchIntoWorkingTree,
- },
- {
- displayString: "pull patch into new commit",
- onPress: gui.handlePullPatchIntoNewCommit,
+ displayString: "copy patch",
+ onPress: gui.handleCopyPatchToClipboard,
},
{
displayString: "apply patch",
@@ -38,6 +30,23 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
},
}
+ if gui.GitCommand.PatchManager.CanRebase {
+ menuItems = append(menuItems, []*menuItem{
+ {
+ displayString: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.PatchManager.Parent),
+ onPress: gui.handleDeletePatchFromCommit,
+ },
+ {
+ displayString: "pull patch out into index",
+ onPress: gui.handlePullPatchIntoWorkingTree,
+ },
+ {
+ displayString: "pull patch into new commit",
+ onPress: gui.handlePullPatchIntoNewCommit,
+ },
+ }...)
+ }
+
selectedCommit := gui.getSelectedCommit()
if selectedCommit != nil && gui.GitCommand.PatchManager.Parent != selectedCommit.Sha {
// adding this option to index 1