Skip to content

Commit

Permalink
[rubygems/rubygems] Fix regression on old git versions
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Nov 8, 2023
1 parent 7f7a7f1 commit 5b076e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/bundler/source/git/git_proxy.rb
Expand Up @@ -131,7 +131,11 @@ def copy_to(destination, submodules = false)
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

Expand Down Expand Up @@ -434,6 +438,10 @@ def supports_minus_c?
@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
Expand Down

0 comments on commit 5b076e0

Please sign in to comment.