1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/sub_commits_panel.go

26 lines
614 B
Go
Raw Normal View History

2020-08-22 00:49:02 +02:00
package gui
import "github.com/jesseduffield/lazygit/pkg/gui/types"
2020-08-22 00:49:02 +02:00
// list panel functions
func (gui *Gui) subCommitsRenderToMain() error {
2022-02-05 08:04:10 +02:00
commit := gui.State.Contexts.SubCommits.GetSelected()
var task types.UpdateTask
2020-08-22 00:49:02 +02:00
if commit == nil {
task = types.NewRenderStringTask("No commits")
2020-08-22 00:49:02 +02:00
} else {
cmdObj := gui.git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
2020-08-22 00:49:02 +02:00
task = types.NewRunPtyTask(cmdObj.GetCmd())
2020-08-22 00:49:02 +02:00
}
return gui.c.RenderToMainViews(types.RefreshMainOpts{
Pair: gui.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: "Commit",
Task: task,
2020-08-22 00:49:02 +02:00
},
})
}