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
|
package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
@ -119,3 +121,11 @@ func (gui *Gui) secondaryPatchPanelUpdateOpts() *viewUpdateOpts {
|
|||||||
|
|
||||||
return nil
|
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{
|
menuItems := []*menuItem{
|
||||||
{
|
{
|
||||||
displayString: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.PatchManager.Parent),
|
displayString: "copy patch",
|
||||||
onPress: gui.handleDeletePatchFromCommit,
|
onPress: gui.handleCopyPatchToClipboard,
|
||||||
},
|
|
||||||
{
|
|
||||||
displayString: "pull patch out into index",
|
|
||||||
onPress: gui.handlePullPatchIntoWorkingTree,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayString: "pull patch into new commit",
|
|
||||||
onPress: gui.handlePullPatchIntoNewCommit,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayString: "apply patch",
|
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()
|
selectedCommit := gui.getSelectedCommit()
|
||||||
if selectedCommit != nil && gui.GitCommand.PatchManager.Parent != selectedCommit.Sha {
|
if selectedCommit != nil && gui.GitCommand.PatchManager.Parent != selectedCommit.Sha {
|
||||||
// adding this option to index 1
|
// adding this option to index 1
|
||||||
|
Loading…
Reference in New Issue
Block a user