diff --git a/pkg/app/app.go b/pkg/app/app.go index f34611b34..f8e267ee9 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -62,6 +62,7 @@ func Run( func NewCommon(config config.AppConfigurer) (*common.Common, error) { userConfig := config.GetUserConfig() + appState := config.GetAppState() var err error log := newLogger(config) @@ -74,6 +75,7 @@ func NewCommon(config config.AppConfigurer) (*common.Common, error) { Log: log, Tr: tr, UserConfig: userConfig, + AppState: appState, Debug: config.GetDebug(), Fs: afero.NewOsFs(), }, nil diff --git a/pkg/commands/git_commands/deps_test.go b/pkg/commands/git_commands/deps_test.go index bb17ad0a7..eaf53306a 100644 --- a/pkg/commands/git_commands/deps_test.go +++ b/pkg/commands/git_commands/deps_test.go @@ -17,6 +17,7 @@ import ( type commonDeps struct { runner *oscommands.FakeCmdObjRunner userConfig *config.UserConfig + appState *config.AppState gitVersion *GitVersion gitConfig *git_config.FakeGitConfig getenv func(string) string @@ -32,7 +33,7 @@ func buildGitCommon(deps commonDeps) *GitCommon { gitCommon.Common = deps.common if gitCommon.Common == nil { - gitCommon.Common = utils.NewDummyCommonWithUserConfig(deps.userConfig) + gitCommon.Common = utils.NewDummyCommonWithUserConfigAndAppState(deps.userConfig, deps.appState) } if deps.fs != nil { diff --git a/pkg/common/common.go b/pkg/common/common.go index 35406118e..39de6e0d8 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -12,6 +12,7 @@ type Common struct { Log *logrus.Entry Tr *i18n.TranslationSet UserConfig *config.UserConfig + AppState *config.AppState Debug bool // for interacting with the filesystem. We use afero rather than the default // `os` package for the sake of mocking the filesystem in tests diff --git a/pkg/utils/dummies.go b/pkg/utils/dummies.go index 96c56b903..120c094f7 100644 --- a/pkg/utils/dummies.go +++ b/pkg/utils/dummies.go @@ -27,12 +27,13 @@ func NewDummyCommon() *common.Common { } } -func NewDummyCommonWithUserConfig(userConfig *config.UserConfig) *common.Common { +func NewDummyCommonWithUserConfigAndAppState(userConfig *config.UserConfig, appState *config.AppState) *common.Common { tr := i18n.EnglishTranslationSet() return &common.Common{ Log: NewDummyLog(), Tr: &tr, UserConfig: userConfig, + AppState: appState, // TODO: remove dependency on actual filesystem in tests and switch to using // in-memory for everything Fs: afero.NewOsFs(),