Skip to content

Commit

Permalink
Test sync_default_gems.rb only when git 2.32 is available
Browse files Browse the repository at this point in the history
With older git, as `GIT_CONFIG_GLOBAL` environment variable is not
supported, these tests clobber user's configurations.
  • Loading branch information
nobu committed Jul 29, 2023
1 parent 6dc15cc commit b0f44cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tool/test/test_sync_default_gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ class TestSyncWithCommits < Test::Unit::TestCase
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"
Expand Down

0 comments on commit b0f44cf

Please sign in to comment.