diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-02-12 18:04:00 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-02-12 18:04:00 +0300 |
commit | ef4fb579a78bf9da22bcb8be399df848c14bd670 (patch) | |
tree | a4f114d4eab5ab2b2e2198b64273acd5aba4df7e /internal/git2go | |
parent | 75c835cb03c95a470becd8bd28cb0013249d407a (diff) |
DI git.CommandFactory into localrepo.Repo
Current implementation of the localrepo.Repo creates
*git.ExecCommandFactory internally and use it for
running git commands. This dependency needs to be
provided from the outside instead. The git.CommandFactory
parameter added to the constructor func and all its usages
fixed thor out the code.
Diffstat (limited to 'internal/git2go')
-rw-r--r-- | internal/git2go/apply_test.go | 3 | ||||
-rw-r--r-- | internal/git2go/commit_test.go | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/internal/git2go/apply_test.go b/internal/git2go/apply_test.go index b782cf13e..f14a97daf 100644 --- a/internal/git2go/apply_test.go +++ b/internal/git2go/apply_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/stretchr/testify/require" + "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/testhelper" @@ -17,7 +18,7 @@ func TestExecutor_Apply(t *testing.T) { pbRepo, repoPath, clean := testhelper.InitBareRepo(t) defer clean() - repo := localrepo.New(pbRepo, config.Config) + repo := localrepo.New(git.NewExecCommandFactory(config.Config), pbRepo, config.Config) executor := New(filepath.Join(config.Config.BinDir, "gitaly-git2go"), config.Config.Git.BinPath) ctx, cancel := testhelper.Context() diff --git a/internal/git2go/commit_test.go b/internal/git2go/commit_test.go index 1e4243c20..7a68081e7 100644 --- a/internal/git2go/commit_test.go +++ b/internal/git2go/commit_test.go @@ -13,6 +13,7 @@ import ( "time" "github.com/stretchr/testify/require" + "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/testhelper" @@ -55,7 +56,7 @@ func TestExecutor_Commit(t *testing.T) { pbRepo, repoPath, clean := testhelper.InitBareRepo(t) defer clean() - repo := localrepo.New(pbRepo, config.Config) + repo := localrepo.New(git.NewExecCommandFactory(config.Config), pbRepo, config.Config) originalFile, err := repo.WriteBlob(ctx, "file", bytes.NewBufferString("original")) require.NoError(t, err) |