aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/support
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-10-08 13:05:31 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-10-09 08:05:23 +0900
commita5bae843ff2b2fe9b46de8766c135489ccda8d9e (patch)
treefb5c51d5b52b9003b67675c9ab78bd1804d37ec8 /spec/bundler/support
parent5a34b639fc8f51f2464f36e59f32eff8b3fd2e0f (diff)
downloadruby-a5bae843ff2b2fe9b46de8766c135489ccda8d9e.tar.gz
[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
Diffstat (limited to 'spec/bundler/support')
-rw-r--r--spec/bundler/support/builders.rb10
1 files changed, 1 insertions, 9 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
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]