From 628cc7e12d7e5cdee2fea7d4490f6f5fbef3adb9 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 29 Jul 2023 13:42:14 +0900 Subject: [PATCH] Change `HOME` too when testing sync_default_gems.rb As well as `GIT_CONFIG_GLOBAL`, which is supported since git 2.32. --- tool/test/test_sync_default_gems.rb | 5 +++-- 1 file 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 test@ruby-lang.org") 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