Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-02-12 18:04:00 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-02-12 18:04:00 +0300
commitef4fb579a78bf9da22bcb8be399df848c14bd670 (patch)
treea4f114d4eab5ab2b2e2198b64273acd5aba4df7e /internal/git2go
parent75c835cb03c95a470becd8bd28cb0013249d407a (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.go3
-rw-r--r--internal/git2go/commit_test.go3
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)