diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2022-12-24 20:42:50 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-25 05:55:36 +0900 |
commit | 8f05e4f54bdb3bcf05574bd5f12e56f7e010c8a2 (patch) | |
tree | f84580ebe619c61036604163ca17aa33a141fda2 /lib/bundler/source/git/git_proxy.rb | |
parent | 3cbe37bd357464c0ce665770998b691cad022a24 (diff) | |
download | ruby-8f05e4f54bdb3bcf05574bd5f12e56f7e010c8a2.tar.gz |
Update Bundler to 2.4.1 & and RubyGems to 3.4.1
Diffstat (limited to 'lib/bundler/source/git/git_proxy.rb')
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 7133e260a0..2a7c8473f5 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -58,6 +58,7 @@ module Bundler @explicit_ref = branch || tag || ref @revision = revision @git = git + @commit_ref = nil end def revision @@ -116,7 +117,7 @@ module Bundler end end - git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination + git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref git "reset", "--hard", @revision, :dir => destination @@ -185,11 +186,16 @@ module Bundler end def refspec - return ref if pinned_to_full_sha? + commit = pinned_to_full_sha? ? ref : @revision - ref_to_fetch = @revision || fully_qualified_ref + if commit + @commit_ref = "refs/#{commit}-sha" + return "#{commit}:#{@commit_ref}" + end + + reference = fully_qualified_ref - ref_to_fetch ||= if ref.include?("~") + reference ||= if ref.include?("~") ref.split("~").first elsif ref.start_with?("refs/") ref @@ -197,7 +203,7 @@ module Bundler "refs/*" end - "#{ref_to_fetch}:#{ref_to_fetch}" + "#{reference}:#{reference}" end def fully_qualified_ref @@ -218,10 +224,6 @@ module Bundler ref =~ /\A\h{40}\z/ end - def legacy_locked_revision? - !@revision.nil? && @revision =~ /\A\h{7}\z/ - end - def git_null(*command, dir: nil) check_allowed(command) @@ -241,9 +243,9 @@ module Bundler out, err, status = capture(command, dir) - Bundler.ui.warn err unless err.empty? + raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, err) unless status.success? - raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, out) unless status.success? + Bundler.ui.warn err unless err.empty? out end @@ -344,9 +346,10 @@ module Bundler end def extra_clone_args - return [] if full_clone? + args = depth_args + return [] if args.empty? - args = ["--depth", depth.to_s, "--single-branch"] + args += ["--single-branch"] args.unshift("--no-tags") if supports_cloning_with_no_tags? args += ["--branch", branch || tag] if branch || tag @@ -361,7 +364,7 @@ module Bundler def extra_fetch_args extra_args = [path.to_s, *depth_args] - extra_args.push(revision) unless legacy_locked_revision? + extra_args.push(@commit_ref) extra_args end |