mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-10-16 09:27:37 +03:00
This is an object that is owned by Gui, is accessible through GuiCommon.State(), and also passed down to GitCommand, where it is mostly needed. Right now it simply wraps access to the Git.Paging config, which isn't very exciting, but we'll extend it in the next commit to handle a slice of pagers (and maintain the currently selected pager index), and doing this refactoring up front allows us to make that change without having to touch clients.
42 lines
954 B
Go
42 lines
954 B
Go
package git_commands
|
|
|
|
import (
|
|
gogit "github.com/jesseduffield/go-git/v5"
|
|
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
|
"github.com/jesseduffield/lazygit/pkg/common"
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
)
|
|
|
|
type GitCommon struct {
|
|
*common.Common
|
|
version *GitVersion
|
|
cmd oscommands.ICmdObjBuilder
|
|
os *oscommands.OSCommand
|
|
repoPaths *RepoPaths
|
|
repo *gogit.Repository
|
|
config *ConfigCommands
|
|
pagerConfig *config.PagerConfig
|
|
}
|
|
|
|
func NewGitCommon(
|
|
cmn *common.Common,
|
|
version *GitVersion,
|
|
cmd oscommands.ICmdObjBuilder,
|
|
osCommand *oscommands.OSCommand,
|
|
repoPaths *RepoPaths,
|
|
repo *gogit.Repository,
|
|
config *ConfigCommands,
|
|
pagerConfig *config.PagerConfig,
|
|
) *GitCommon {
|
|
return &GitCommon{
|
|
Common: cmn,
|
|
version: version,
|
|
cmd: cmd,
|
|
os: osCommand,
|
|
repoPaths: repoPaths,
|
|
repo: repo,
|
|
config: config,
|
|
pagerConfig: pagerConfig,
|
|
}
|
|
}
|