diff options
author | Hiroshi SHIBATA <[email protected]> | 2022-12-15 18:00:04 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2022-12-15 19:06:40 +0900 |
commit | 49b0f3b024855efad66a386595eabd103058826d () | |
tree | 629182a46cb9e8b4bc9661878e07e1e9a539ac32 /lib/bundler/source/git | |
parent | 2581de112c1957dc4b5852e54337551dc8972c99 (diff) |
Merge RubyGems/Bundler master
Pick from https://.com/rubygems/rubygems/commit/084f7d1f21f6fc3e2bb685b7bda3653fb2891c6e
Notes: Merged: https://.com/ruby/ruby/pull/6936
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 68 |
1 files changed, 47 insertions, 21 deletions
@@ -61,7 +61,7 @@ module Bundler end def revision - @revision ||= find_local_revision end def current_branch @@ -90,16 +90,11 @@ module Bundler Bundler.ui.info "Fetching #{credential_filtered_uri}" - unless path.exist? - SharedHelpers.filesystem_access(path.dirname) do |p| - FileUtils.mkdir_p(p) - end - git_retry "clone", "--bare", "--no-hardlinks", "--quiet", *extra_clone_args, "--", configured_uri, path.to_s - return unless extra_ref - end - fetch_args = extra_fetch_args - fetch_args.unshift("--unshallow") if path.join("shallow").exist? && full_clone? git_retry(*["fetch", "--force", "--quiet", "--no-tags", *fetch_args, "--", configured_uri, refspec].compact, :dir => path) end @@ -123,7 +118,7 @@ module Bundler end end - git(*["fetch", "--force", "--quiet", *extra_fetch_args, path.to_s, revision_refspec].compact, :dir => destination) git "reset", "--hard", @revision, :dir => destination @@ -137,6 +132,24 @@ module Bundler private def extra_ref return false if not_pinned? return true unless full_clone? @@ -147,7 +160,7 @@ module Bundler def depth return @depth if defined?(@depth) - @depth = if legacy_locked_revision? || !supports_fetching_unreachable_refs? nil elsif not_pinned? 1 @@ -241,11 +254,24 @@ module Bundler end def find_local_revision - allowed_with_path do - git("rev-parse", "--verify", branch || tag || ref || "HEAD", :dir => path).strip - end rescue GitCommandError => e - raise MissingGitRevisionError.new(e.command, path, branch || tag || ref, credential_filtered_uri) end # Adds credentials to the URI @@ -325,16 +351,16 @@ module Bundler args end - def extra_fetch_args return [] if full_clone? ["--depth", depth.to_s] end - def revision_refspec - return if legacy_locked_revision? - - revision end def full_clone? |