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:
authorRobert Speicher <rspeicher@gmail.com>2020-04-10 23:41:11 +0300
committerRobert Speicher <rspeicher@gmail.com>2020-04-10 23:49:27 +0300
commitceb71b01fcdb6469545ffef3d9a7c9e98bef875a (patch)
tree215c74c76bb2e4216054e9b47c688d941879a96e
parent3fd68cb778b5a43c23072b345bf0a27b60b64af6 (diff)
Use GIT_CONFIG instead of overwriting HOME envrs-revert-3b7e6f76
-rw-r--r--internal/testhelper/testhelper.go19
-rw-r--r--ruby/spec/support/helpers/gitlab_shell_helper.rb4
2 files changed, 5 insertions, 18 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index d0003e1e1..7681b9214 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -288,23 +288,10 @@ func ConfigureGit() error {
return fmt.Errorf("could not get caller info")
}
- goenvCmd := exec.Command("go", "env", "GOCACHE")
- goCacheBytes, err := goenvCmd.Output()
- goCache := strings.TrimSpace(string(goCacheBytes))
- if err != nil {
- return err
- }
-
- // set GOCACHE env to current go cache location, otherwise if it's default it would be overwritten by setting HOME
- err = os.Setenv("GOCACHE", goCache)
- if err != nil {
- return err
- }
-
- testHome := filepath.Join(filepath.Dir(currentFile), "testdata/home")
+ testConfig := filepath.Join(filepath.Dir(currentFile), "testdata/home/.gitconfig")
- // overwrite HOME env variable so user global .gitconfig doesn't influence tests
- return os.Setenv("HOME", testHome)
+ // overwrite GIT_CONFIG so user .gitconfig doesn't influence tests
+ return os.Setenv("GIT_CONFIG", testConfig)
}
// ConfigureRuby configures Ruby settings for test purposes at run time.
diff --git a/ruby/spec/support/helpers/gitlab_shell_helper.rb b/ruby/spec/support/helpers/gitlab_shell_helper.rb
index 7c1aafb4d..81b5f6018 100644
--- a/ruby/spec/support/helpers/gitlab_shell_helper.rb
+++ b/ruby/spec/support/helpers/gitlab_shell_helper.rb
@@ -5,8 +5,8 @@ TMP_DIR_NAME = 'tmp'.freeze
TMP_DIR = File.join(GITALY_RUBY_DIR, TMP_DIR_NAME).freeze
GITLAB_SHELL_DIR = File.join(TMP_DIR, 'gitlab-shell').freeze
-# overwrite HOME env variable so user global .gitconfig doesn't influence tests
-ENV["HOME"] = File.join(File.dirname(__FILE__), "/testdata/home")
+# overwrite GIT_CONFIG so user .gitconfig doesn't influence tests
+ENV["GIT_CONFIG"] = File.join(File.dirname(__FILE__), "/testdata/home/.gitconfig")
module GitlabShellHelper
def self.setup_gitlab_shell