aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-09-18 20:32:26 +0200
committergit <svn-admin@ruby-lang.org>2022-09-28 23:01:20 +0900
commit3c3bd03a7c4d2213367c65a9aa92f255e1d6cbc9 (patch)
tree808a66f480eefcd0ca6d19861c2ee4c4be462843 /test/rubygems
parent28a572f8bffe54226a7ad3fae814c1c92b5036e6 (diff)
downloadruby-3c3bd03a7c4d2213367c65a9aa92f255e1d6cbc9.tar.gz
[rubygems/rubygems] Force "master" to be used regardless of `init.defaultBranch` config
Otherwise, if you have `init.defaultBranch main` configured, like I do, a bunch of tests fail with things like: ``` ============================================================================================================================================================================================================ Error: test_checkout_submodules(TestGemSourceGit): Gem::Exception: unable to find reference master in /Users/deivid/Code/rubygems/rubygems/tmp/test_rubygems_20220928-13878-xog1je/git/a /Users/deivid/Code/rubygems/rubygems/lib/rubygems/source/git.rb:188:in `rev_parse' /Users/deivid/Code/rubygems/rubygems/lib/rubygems/source/git.rb:143:in `dir_shortref' /Users/deivid/Code/rubygems/rubygems/lib/rubygems/source/git.rb:158:in `install_dir' /Users/deivid/Code/rubygems/rubygems/lib/rubygems/source/git.rb:94:in `checkout' /Users/deivid/Code/rubygems/rubygems/test/rubygems/test_gem_source_git.rb:78:in `test_checkout_submodules' 75: system @git, "commit", "--quiet", "-m", "add submodule b" 76: end 77: => 78: source.checkout 79: 80: assert_path_exist File.join source.install_dir, "a.gemspec" 81: assert_path_exist File.join source.install_dir, "b/b.gemspec" ============================================================================================================================================================================================================ fatal: ambiguous argument 'master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' fatal: ambiguous argument 'master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' E ``` In the future, I'd like to change things to use `main`, but the straighforward fix now is to keep "master" and make the running environment's git configuration not get in the middle. https://github.com/rubygems/rubygems/commit/b09b1416f1
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/helper.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index 258107bf04..8c959bae9c 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -575,6 +575,7 @@ class Gem::TestCase < Test::Unit::TestCase
Dir.chdir directory do
unless File.exist? ".git"
system @git, "init", "--quiet"
+ system @git, "checkout", "-b", "master", "--quiet"
system @git, "config", "user.name", "RubyGems Tests"
system @git, "config", "user.email", "rubygems@example"
end