From 6cda774b5e8d89a37039924cce31d20736770836 Mon Sep 17 00:00:00 2001 From: Pavlo Strokov Date: Thu, 26 Nov 2020 17:44:37 +0200 Subject: 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 --- internal/git2go/apply_test.go | 3 +-- internal/git2go/commit_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'internal/git2go') 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 -- cgit v1.2.3