diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-11-26 18:44:37 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2020-11-29 19:32:54 +0300 |
commit | 6cda774b5e8d89a37039924cce31d20736770836 (patch) | |
tree | e68e3d67bbe610f37d44ba191571212d4a80a4e5 /internal/git2go | |
parent | bbff75dd8e27ef30c9a179ec41bb3cd5a7f46dfd (diff) |
Removal of command.GitPath()
Function 'command.GitPath()' depends on the global 'config.Config' variable
and uses internal call to change the state of it in case it is not
yet initialized properly. To break this dependency we remove the function
and replaces it with direct access to the configured value.
It could be set from the config.toml file or from env using GITALY_TESTING_GIT_BINARY.
If none used the value will be resolved from the system.
In the tests the value is set on the configuration stage and point to the temporary
directory.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
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, 2 insertions, 4 deletions
diff --git a/internal/git2go/apply_test.go b/internal/git2go/apply_test.go index 1744432b6..fe12d603d 100644 --- a/internal/git2go/apply_test.go +++ b/internal/git2go/apply_test.go @@ -8,7 +8,6 @@ import ( "time" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/internal/command" "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/testhelper" @@ -19,7 +18,7 @@ func TestExecutor_Apply(t *testing.T) { defer clean() repo := git.NewRepository(pbRepo) - executor := New(filepath.Join(config.Config.BinDir, "gitaly-git2go"), command.GitPath()) + executor := New(filepath.Join(config.Config.BinDir, "gitaly-git2go"), config.Config.Git.BinPath) ctx, cancel := testhelper.Context() defer cancel() diff --git a/internal/git2go/commit_test.go b/internal/git2go/commit_test.go index 0fbe24bd7..215cc59da 100644 --- a/internal/git2go/commit_test.go +++ b/internal/git2go/commit_test.go @@ -13,7 +13,6 @@ import ( "time" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/internal/command" "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/testhelper" @@ -64,7 +63,7 @@ func TestExecutor_Commit(t *testing.T) { updatedFile, err := repo.WriteBlob(ctx, "file", bytes.NewBufferString("updated")) require.NoError(t, err) - executor := New(filepath.Join(config.Config.BinDir, "gitaly-git2go"), command.GitPath()) + executor := New(filepath.Join(config.Config.BinDir, "gitaly-git2go"), config.Config.Git.BinPath) for _, tc := range []struct { desc string |