[前][次][番号順一覧][スレッド一覧]

ruby-changes:68318

From: David <ko1@a...>
Date: Sat, 9 Oct 2021 09:27:18 +0900 (JST)
Subject: [ruby-changes:68318] a5bae843ff (master): [rubygems/rubygems] Let `update_git` work with whatever branch is checkout out

https://git.ruby-lang.org/ruby.git/commit/?id=a5bae843ff

From a5bae843ff2b2fe9b46de8766c135489ccda8d9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 8 Oct 2021 13:05:31 +0200
Subject: [rubygems/rubygems] Let `update_git` work with whatever branch is
 checkout out

Unless the `:branch` option is passed.

It's more efficient, and it results in less hardcoding of "master".

https://github.com/rubygems/rubygems/commit/aa5c3409ab
---
 spec/bundler/support/builders.rb | 10 +---------
 spec/bundler/update/git_spec.rb  |  4 ++--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 3db84b277d..58e4d147dc 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -553,17 +553,9 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/builders.rb#L553
         update_gemspec = options[:gemspec] || false
         source = options[:source] || "git@#{libpath}"
 
-        @context.git "checkout master", libpath
-
         if branch = options[:branch]
           raise "You can't specify `master` as the branch" if branch == "master"
-          escaped_branch = Shellwords.shellescape(branch)
-
-          if @context.git("branch --list #{escaped_branch}", libpath).empty?
-            @context.git("branch #{escaped_branch}", libpath)
-          end
-
-          @context.git("checkout #{escaped_branch}", libpath)
+          @context.git("checkout -b #{Shellwords.shellescape(branch)}", libpath)
         elsif tag = options[:tag]
           @context.git("tag #{Shellwords.shellescape(tag)}", libpath)
         elsif options[:remote]
diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb
index 26ad1b45d3..f35d5857c6 100644
--- a/spec/bundler/update/git_spec.rb
+++ b/spec/bundler/update/git_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe "bundle update" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/update/git_spec.rb#L13
         end
       G
 
-      update_git "foo", :branch => "omg" do |s|
+      update_git "foo" do |s|
         s.write "lib/foo.rb", "FOO = '1.1'"
       end
 
@@ -48,7 +48,7 @@ RSpec.describe "bundle update" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/update/git_spec.rb#L48
         end
       G
 
-      update_git "foo", :branch => "omg", :path => lib_path("foo") do |s|
+      update_git "foo", :path => lib_path("foo") do |s|
         s.write "lib/foo.rb", "FOO = '1.1'"
       end
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]