1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 22:33:07 +02:00

Remove unnecessary setSubCommits indirection

I don't know why this function argument was added, but I don't like unnecessary
indirections, so I'm removing it as SubCommitsHelper has access to everything it
needs to do it itself.
This commit is contained in:
Stefan Haller
2025-07-10 13:59:52 +02:00
parent e1d728ee5e
commit 33a4fdf0ee
2 changed files with 8 additions and 10 deletions

View File

@ -11,18 +11,15 @@ type SubCommitsHelper struct {
c *HelperCommon
refreshHelper *RefreshHelper
setSubCommits func([]*models.Commit)
}
func NewSubCommitsHelper(
c *HelperCommon,
refreshHelper *RefreshHelper,
setSubCommits func([]*models.Commit),
) *SubCommitsHelper {
return &SubCommitsHelper{
c: c,
refreshHelper: refreshHelper,
setSubCommits: setSubCommits,
}
}
@ -73,3 +70,10 @@ func (self *SubCommitsHelper) ViewSubCommits(opts ViewSubCommitsOpts) error {
self.c.Context().Push(self.c.Contexts().SubCommits, types.OnFocusOpts{})
return nil
}
func (self *SubCommitsHelper) setSubCommits(commits []*models.Commit) {
self.c.Mutexes().SubCommitsMutex.Lock()
defer self.c.Mutexes().SubCommitsMutex.Unlock()
self.c.Model().SubCommits = commits
}