[rubygems/rubygems] Support git 2.49

One error message that we parse is now slightly different.

758528791d
This commit is contained in:
David Rodríguez 2025-03-20 18:19:58 +01:00 committed by Hiroshi SHIBATA
parent 5b3970f68b
commit 2efa400539

View file

@ -179,7 +179,8 @@ module Bundler
_, err, status = capture(command, nil) _, err, status = capture(command, nil)
return extra_ref if status.success? return extra_ref if status.success?
if err.include?("Could not find remote branch") if err.include?("Could not find remote branch") || # git up to 2.49
err.include?("Remote branch #{branch_option} not found") # git 2.49 or higher
raise MissingGitRevisionError.new(command_with_no_credentials, nil, explicit_ref, credential_filtered_uri) raise MissingGitRevisionError.new(command_with_no_credentials, nil, explicit_ref, credential_filtered_uri)
else else
idx = command.index("--depth") idx = command.index("--depth")
@ -256,7 +257,7 @@ module Bundler
end end
def not_pinned? def not_pinned?
branch || tag || ref.nil? branch_option || ref.nil?
end end
def pinned_to_full_sha? def pinned_to_full_sha?
@ -420,7 +421,7 @@ module Bundler
# anyways. # anyways.
return args if @revision return args if @revision
args += ["--branch", branch || tag] if branch || tag args += ["--branch", branch_option] if branch_option
args args
end end
@ -436,6 +437,10 @@ module Bundler
extra_args extra_args
end end
def branch_option
branch || tag
end
def full_clone? def full_clone?
depth.nil? depth.nil?
end end