1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-22 05:29:44 +02:00
lazygit/pkg/gui/sub_commits_panel.go

26 lines
614 B
Go
Raw Normal View History

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