summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-07-29 13:42:14 +0900
committerNobuyoshi Nakada <[email protected]>2023-07-29 20:02:47 +0900
commit628cc7e12d7e5cdee2fea7d4490f6f5fbef3adb9 (patch)
treed272960ea63f95dac8e4e25a3947cb801c38d05b
parent4b91d6abb907fe3375fbd04a6af910d8b1792d78 (diff)
Change `HOME` too when testing sync_default_gems.rb
As well as `GIT_CONFIG_GLOBAL`, which is supported since git 2.32.
-rwxr-xr-xtool/test/test_sync_default_gems.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb
index 8e667fc4d2..39eab3f205 100755
--- a/tool/test/test_sync_default_gems.rb
+++ b/tool/test/test_sync_default_gems.rb
@@ -80,7 +80,8 @@ module Test_SyncDefaultGems
@target = nil
pend "No git" unless system("git --version", out: IO::NULL)
@testdir = Dir.mktmpdir("sync")
- @git_config = ENV["GIT_CONFIG_GLOBAL"]
+ @git_config = %W"HOME GIT_CONFIG_GLOBAL".each_with_object({}) {|k, c| c[k] = ENV[k]}
+ ENV["HOME"] = @testdir
ENV["GIT_CONFIG_GLOBAL"] = @testdir + "/gitconfig"
system(*%W"git config --global user.email [email protected]")
system(*%W"git config --global user.name", "Ruby")
@@ -105,7 +106,7 @@ module Test_SyncDefaultGems
if @target
Dir.chdir(@origdir)
SyncDefaultGems::REPOSITORIES.delete(@target.to_sym)
- ENV["GIT_CONFIG_GLOBAL"] = @git_config
+ ENV.update(@git_config)
FileUtils.rm_rf(@testdir)
end
super