Skip to content

Commit ae0296a

Browse files
hsbtclaude
andcommitted
Require spec path helpers lazily in the git config guard
support/subprocess.rb is preloaded into every spawned ruby before RubygemsVersionManager switches RubyGems, and requiring support/path at load time dragged the pathname default gem into that context, breaking Bundler unit specs under a ruby-core setup. Require it only when a local git config write actually needs the tmp root check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 4a49cfd commit ae0296a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

spec/support/subprocess.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

33
require_relative "command_execution"
4-
require_relative "path"
54

65
module Spec
76
module Subprocess
@@ -47,6 +46,10 @@ def reject_git_config_pollution!(cmd, path)
4746
return if args.any? {|a| ["--global", "--system", "-f", "--file"].include?(a) || a.start_with?("--file=") }
4847
return if args.any? {|a| ["--get", "--get-all", "--get-regexp", "--get-urlmatch", "--list", "-l"].include?(a) }
4948

49+
# Required lazily because this file is loaded in every spawned ruby
50+
# before RubygemsVersionManager switches RubyGems, where loading extra
51+
# default gems (pathname, through support/path) breaks the setup.
52+
require_relative "path"
5053
dir = File.expand_path(path.to_s)
5154
tmp_root = Spec::Path.tmp_root.to_s
5255
return if dir == tmp_root || dir.start_with?(tmp_root + File::SEPARATOR)

0 commit comments

Comments
 (0)