diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-10-26 20:16:07 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-11-08 09:04:28 +0900 |
commit | 5b076e00ce138ab4a81f0951dc23b82f015f011e (patch) | |
tree | 0755c225adfb3a328a3f83ba21e3b78ce4c5e83c /lib | |
parent | 7f7a7f13ededda5c91d84c3493dc6ef3cec53d1a (diff) | |
download | ruby-5b076e00ce138ab4a81f0951dc23b82f015f011e.tar.gz |
[rubygems/rubygems] Fix regression on old git versions
https://github.com/rubygems/rubygems/commit/abd91ca2e5
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 93625145c4..0b507abc76 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -131,7 +131,11 @@ module Bundler end ref = @commit_ref || (locked_to_full_sha? && @revision) - git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination if ref + if ref + git "config", "uploadpack.allowAnySHA1InWant", "true", :dir => path.to_s if @commit_ref.nil? && needs_allow_any_sha1_in_want? + + git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination + end git "reset", "--hard", @revision, :dir => destination @@ -434,6 +438,10 @@ module Bundler @supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5") end + def needs_allow_any_sha1_in_want? + @needs_allow_any_sha1_in_want ||= Gem::Version.new(version) <= Gem::Version.new("2.13.7") + end + def supports_fetching_unreachable_refs? @supports_fetching_unreachable_refs ||= Gem::Version.new(version) >= Gem::Version.new("2.5.0") end |