From 007235df2355bfeacc206b78e9827fff529d32a2 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 7 Jan 2022 14:45:18 +1100 Subject: refactor --- pkg/commands/git.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/commands/git.go') diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 4866655e0..2f4c68fb8 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -92,6 +92,10 @@ func NewGitCommandAux( ) *GitCommand { cmd := NewGitCmdObjBuilder(cmn.Log, osCommand.Cmd) + // here we're doing a bunch of dependency injection for each of our commands structs. + // 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 := NewConfigCommands(cmn, gitConfig) statusCommands := NewStatusCommands(cmn, osCommand, repo, dotGitDir) fileLoader := loaders.NewFileLoader(cmn, cmd, configCommands) -- cgit v1.2.3