summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
blob: b9a25ea672658b0494a7a7a993c6c234f69b23fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package gui

import "github.com/jesseduffield/lazygit/pkg/gui/types"

func (gui *Gui) branchesRenderToMain() error {
	var task types.UpdateTask
	branch := gui.State.Contexts.Branches.GetSelected()
	if branch == nil {
		task = types.NewRenderStringTask(gui.c.Tr.NoBranchesThisRepo)
	} else {
		cmdObj := gui.git.Branch.GetGraphCmdObj(branch.FullRefName())

		task = types.NewRunPtyTask(cmdObj.GetCmd())
	}

	return gui.c.RenderToMainViews(types.RefreshMainOpts{
		Pair: gui.c.MainViewPairs().Normal,
		Main: &types.ViewUpdateOpts{
			Title: gui.c.Tr.LogTitle,
			Task:  task,
		},
	})
}