blob: 735e0434f88152fb9c2d86e0b48eef00ea1fc0df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package controllers
import (
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type ReflogCommitsController struct {
baseController
c *ControllerCommon
}
var _ types.IController = &ReflogCommitsController{}
func NewReflogCommitsController(
common *ControllerCommon,
) *ReflogCommitsController {
return &ReflogCommitsController{
baseController: baseController{},
c: common,
}
}
func (self *ReflogCommitsController) Context() types.Context {
return self.context()
}
func (self *ReflogCommitsController) context() *context.ReflogCommitsContext {
return self.c.Contexts().ReflogCommits
}
func (self *ReflogCommitsController) GetOnRenderToMain() func() error {
return func() error {
return self.c.Helpers().Diff.WithDiffModeCheck(func() error {
commit := self.context().GetSelected()
var task types.UpdateTask
if commit == nil {
task = types.NewRenderStringTask("No reflog history")
} else {
cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.State().GetIgnoreWhitespaceInDiffView())
task = types.NewRunPtyTask(cmdObj.GetCmd())
}
return self.c.RenderToMainViews(types.RefreshMainOpts{
Pair: self.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: "Reflog Entry",
Task: task,
},
})
})
}
}
|