diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-23 10:29:06 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-24 10:08:23 +0300 |
commit | ab1e3d7ecdcde5a1be5dea429cea2141463f1e60 (patch) | |
tree | b72722f34f25360317068327e27154eadcf5bb93 | |
parent | 17ea352bda277f235003353b6e70aba42ad562e0 (diff) |
specs: Fix Rugged picking up gitconfig filespks-gitaly-gitconfig-clean
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.rb | 6 |
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 } |