diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-22 08:20:23 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-24 16:57:07 +0900 |
commit | f6620037ba1477d2c337d7b511f094d6d0fbb69c (patch) | |
tree | 4d8d38eaf97e6ca88162dd574e7871e1739f22ae /lib/bundler/source | |
parent | d5635dfe36588b04d3dd6065ab4e422f51629b11 (diff) | |
download | ruby-f6620037ba1477d2c337d7b511f094d6d0fbb69c.tar.gz |
Merge RubyGems-3.4.0 and Bundler-2.4.0
Diffstat (limited to 'lib/bundler/source')
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 31b3107c9e..7133e260a0 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -176,37 +176,32 @@ module Bundler @depth = if !supports_fetching_unreachable_refs? nil - elsif not_pinned? + elsif not_pinned? || pinned_to_full_sha? 1 elsif ref.include?("~") parsed_depth = ref.split("~").last parsed_depth.to_i + 1 - elsif abbreviated_ref? - nil - else - 1 end end def refspec - if fully_qualified_ref - "#{fully_qualified_ref}:#{fully_qualified_ref}" - elsif ref.include?("~") - parsed_ref = ref.split("~").first - "#{parsed_ref}:#{parsed_ref}" + return ref if pinned_to_full_sha? + + ref_to_fetch = @revision || fully_qualified_ref + + ref_to_fetch ||= if ref.include?("~") + ref.split("~").first elsif ref.start_with?("refs/") - "#{ref}:#{ref}" - elsif abbreviated_ref? - nil - else ref + else + "refs/*" end + + "#{ref_to_fetch}:#{ref_to_fetch}" end def fully_qualified_ref - return @fully_qualified_ref if defined?(@fully_qualified_ref) - - @fully_qualified_ref = if branch + if branch "refs/heads/#{branch}" elsif tag "refs/tags/#{tag}" @@ -219,8 +214,8 @@ module Bundler branch || tag || ref.nil? end - def abbreviated_ref? - ref =~ /\A\h+\z/ && ref !~ /\A\h{40}\z/ + def pinned_to_full_sha? + ref =~ /\A\h{40}\z/ end def legacy_locked_revision? |