mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-12 11:15:00 +02:00
only show rebasey commands on a local commit when patch building
This commit is contained in:
parent
e6a1bd6566
commit
1fd0f31682
@ -1,6 +1,8 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
@ -119,3 +121,11 @@ func (gui *Gui) secondaryPatchPanelUpdateOpts() *viewUpdateOpts {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gui *Gui) handleCopyPatchToClipboard() error {
|
||||
// TODO: test that this works
|
||||
|
||||
return gui.OSCommand.CopyToClipboard(
|
||||
strings.Join(gui.GitCommand.PatchManager.RenderEachFilePatch(true), "\n"),
|
||||
)
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user