diff options
author | krororo <krororo.07@gmail.com> | 2023-09-20 09:47:23 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-09-27 05:18:10 +0000 |
commit | fbee93fc19420ea2b734cffc742ef34599c380db (patch) | |
tree | e026c87737a8ee6031ea09980e28fe74a1e6c828 /lib/bundler/source | |
parent | 57c3e45ee8d43c401ff1e52105ecbca2bd4e7550 (diff) |
[rubygems/rubygems] Fix bundle install when older revisions of git source
https://github.com/rubygems/rubygems/commit/a30712c0fc
Diffstat (limited to 'lib/bundler/source')
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 11 |
1 files changed, 8 insertions, 3 deletions
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 |