ruby-changes:73761
From: David <ko1@a...>
Date: Wed, 28 Sep 2022 23:01:38 +0900 (JST)
Subject: [ruby-changes:73761] 3c3bd03a7c (master): [rubygems/rubygems] Force "master" to be used regardless of `init.defaultBranch` config
https://git.ruby-lang.org/ruby.git/commit/?id=3c3bd03a7c From 3c3bd03a7c4d2213367c65a9aa92f255e1d6cbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sun, 18 Sep 2022 20:32:26 +0200 Subject: [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 --- test/rubygems/helper.rb | 1 + 1 file changed, 1 insertion(+) 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 https://github.com/ruby/ruby/blob/trunk/test/rubygems/helper.rb#L575 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/