From fbee93fc19420ea2b734cffc742ef34599c380db Mon Sep 17 00:00:00 2001 From: krororo Date: Wed, 20 Sep 2023 09:47:23 +0900 Subject: [rubygems/rubygems] Fix bundle install when older revisions of git source https://github.com/rubygems/rubygems/commit/a30712c0fc --- lib/bundler/source/git/git_proxy.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 53a9a78ddf..4922321343 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -118,7 +118,8 @@ module Bundler end end - git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref + ref = @commit_ref || (full_sha_revision? && @revision) + git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination if ref git "reset", "--hard", @revision, :dir => destination @@ -238,6 +239,10 @@ module Bundler ref =~ /\A\h{40}\z/ end + def full_sha_revision? + @revision.match?(/\A\h{40}\z/) + end + def git_null(*command, dir: nil) check_allowed(command) @@ -399,9 +404,9 @@ module Bundler ["--depth", depth.to_s] end - def extra_fetch_args + def extra_fetch_args(ref) extra_args = [path.to_s, *depth_args] - extra_args.push(@commit_ref) + extra_args.push(ref) extra_args end -- cgit v1.2.3