diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-29 11:49:53 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-29 11:49:53 +0900 |
| commit | b0f44cfa5da53b90817732cb25b4d3a1cddecb89 (patch) | |
| tree | 963aeee690039c8550d244fc89e2bacb932320c3 | |
| parent | 6dc15cc8895b28800d5c187929d846ac4eb7cd3f (diff) | |
Test sync_default_gems.rb only when git 2.32 is available
With older git, as `GIT_CONFIG_GLOBAL` environment variable is not
supported, these tests clobber user's configurations.
| -rwxr-xr-x | tool/test/test_sync_default_gems.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index 8e667fc4d2..625007ca06 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -78,7 +78,15 @@ module Test_SyncDefaultGems def setup super @target = nil - pend "No git" unless system("git --version", out: IO::NULL) + begin + git_version = IO.popen(%W"git --version", &:read) + rescue Errno::ENOENT + pend "No git" + else + v = git_version.scan(/\d+/).map(&:to_i) + # GIT_CONFIG_GLOBAL is supported since 2.32. + pend "#{git_version} is too old" if (v <=> [2, 32]) < 0 + end @testdir = Dir.mktmpdir("sync") @git_config = ENV["GIT_CONFIG_GLOBAL"] ENV["GIT_CONFIG_GLOBAL"] = @testdir + "/gitconfig" |
