diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-01 23:29:38 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-01 23:29:38 +0000 |
commit | be7b5929126cb3e696ef222339237faba9b8fe5a (patch) | |
tree | 51eae376f93c09bc82dde5a657a91df2c89062e4 /lib/bundler/source/git/git_proxy.rb | |
parent | ae49dbd392083f69026f2a0fff4a1d5f42d172a7 (diff) | |
download | ruby-be7b5929126cb3e696ef222339237faba9b8fe5a.tar.gz |
Update bundled bundler to 1.16.0.
* lib/bundler, spec/bundler: Merge bundler-1.16.0.
* common.mk: rspec examples of bundler-1.16.0 needs require option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/bundler/source/git/git_proxy.rb')
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index c05d7a5afa..c56dda66ea 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "shellwords" require "tempfile" module Bundler @@ -62,7 +63,7 @@ module Bundler begin @revision ||= find_local_revision rescue GitCommandError - raise MissingGitRevisionError.new(ref, uri) + raise MissingGitRevisionError.new(ref, URICredentialsFilter.credential_filtered_uri(uri)) end @revision @@ -90,18 +91,21 @@ module Bundler end def checkout - if path.exist? - return if has_revision_cached? - Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" - in_path do - git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*") - end - else - Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" + return if path.exist? && has_revision_cached? + extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/") + + Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" + + unless path.exist? SharedHelpers.filesystem_access(path.dirname) do |p| FileUtils.mkdir_p(p) end git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet) + return unless extra_ref + end + + in_path do + git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref}) end end @@ -149,7 +153,7 @@ module Bundler end def git_retry(command) - Bundler::Retry.new("`git #{command}`", GitNotAllowedError).attempts do + Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do git(command) end end @@ -217,6 +221,7 @@ module Bundler def in_path(&blk) checkout unless path.exist? + _ = URICredentialsFilter # load it before we chdir SharedHelpers.chdir(path, &blk) end |