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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-23 10:29:06 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-25 08:17:28 +0300
commit016a6210c220e8895846f0a44d91e9fbcaaa214a (patch)
tree9980e57b5223eb3b704ef16dfeb5ba4e466fb0ca
parentbd36ec0192784394a1b867396cb865daeb179790 (diff)
specs: Fix Rugged picking up gitconfig files
While we make sure to override `HOME` in our Ruby specs so that Git wouldn't pick up the gitconfig, libgit2 in fact parses the passwd file to obtain the user's home directory. Consequentially, overriding the environment variable is not sufficient to keep libgit2 from reading the user's gitconfig files. Fix this issue by overriding Rugged's gitconfig search paths.
-rw-r--r--ruby/spec/spec_helper.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb
index 52296007e..dcd20550e 100644
--- a/ruby/spec/spec_helper.rb
+++ b/ruby/spec/spec_helper.rb
@@ -13,6 +13,12 @@ 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__), "/support/helpers/testdata/home")
+# Furthermore, overwrite the Rugged search path so that it doesn't pick up any
+# gitconfig, either.
+Rugged::Settings['search_path_system'] = '/dev/null'
+Rugged::Settings['search_path_global'] = '/dev/null'
+Rugged::Settings['search_path_xdg'] = '/dev/null'
+
require 'test_repo_helper'
Dir[File.join(__dir__, 'support/helpers/*.rb')].each { |f| require f }