summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-08 14:44:07 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-09 14:09:53 +1100
commite4e521f58a35ff177c8a3ef3a5be5057420cc2ba (patch)
tree70aec0aee62d588faf85a478e774b87c75728327 /pkg
parentfdf79fdeee71b7f281a53c72c7a0be61136bef34 (diff)
pass repo to struct
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/git.go2
-rw-r--r--pkg/commands/git_commands/config.go2
-rw-r--r--pkg/commands/git_commands/deps_test.go6
3 files changed, 8 insertions, 2 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index 70aa859e9..d3ea3166c 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -92,7 +92,7 @@ func NewGitCommandAux(
// This is admittedly messy, but allows us to test each command struct in isolation,
// and allows for better namespacing when compared to having every method living
// on the one struct.
- configCommands := git_commands.NewConfigCommands(cmn, gitConfig)
+ configCommands := git_commands.NewConfigCommands(cmn, gitConfig, repo)
statusCommands := git_commands.NewStatusCommands(cmn, osCommand, repo, dotGitDir)
fileLoader := loaders.NewFileLoader(cmn, cmd, configCommands)
flowCommands := git_commands.NewFlowCommands(cmn, cmd, configCommands)
diff --git a/pkg/commands/git_commands/config.go b/pkg/commands/git_commands/config.go
index 1818edc2d..e22333541 100644
--- a/pkg/commands/git_commands/config.go
+++ b/pkg/commands/git_commands/config.go
@@ -22,10 +22,12 @@ type ConfigCommands struct {
func NewConfigCommands(
common *common.Common,
gitConfig git_config.IGitConfig,
+ repo *gogit.Repository,
) *ConfigCommands {
return &ConfigCommands{
Common: common,
gitConfig: gitConfig,
+ repo: repo,
}
}
diff --git a/pkg/commands/git_commands/deps_test.go b/pkg/commands/git_commands/deps_test.go
index f0d7a2a7b..186ce1d87 100644
--- a/pkg/commands/git_commands/deps_test.go
+++ b/pkg/commands/git_commands/deps_test.go
@@ -2,6 +2,7 @@ package git_commands
import (
"github.com/go-errors/errors"
+ gogit "github.com/jesseduffield/go-git/v5"
"github.com/jesseduffield/lazygit/pkg/commands/git_config"
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
@@ -61,7 +62,10 @@ func buildConfigCommands(deps commonDeps) *ConfigCommands {
deps = completeDeps(deps)
common := utils.NewDummyCommonWithUserConfig(deps.userConfig)
- return NewConfigCommands(common, deps.gitConfig)
+ // TODO: think of a way to actually mock this outnil
+ var repo *gogit.Repository = nil
+
+ return NewConfigCommands(common, deps.gitConfig, repo)
}
func buildOSCommand(deps commonDeps) *oscommands.OSCommand {