[rubygems/rubygems] Restore support for passing relative paths to `:git`

The `file://` protocol does not really work with relative paths and it's
not necessary anyways. So restore support for that by not using
`file://`.

https://github.com/rubygems/rubygems/commit/16a68998ce
This commit is contained in:
David Rodríguez 2024-08-19 21:23:34 +02:00 коммит произвёл git
Родитель 52c02794df
Коммит 669d1f79d8
3 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -336,8 +336,6 @@ module Bundler
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
remote.userinfo ||= config_auth
remote.to_s
elsif File.exist?(uri)
"file://#{uri}"
else
uri.to_s
end

Просмотреть файл

@ -56,7 +56,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
fetch_args = %w(fetch --force --quiet --no-tags)
clone_args = %w(clone --bare --no-hardlinks --quiet)
if (fetch_args.-(ARGV).empty? || clone_args.-(ARGV).empty?) && ARGV.any? {|arg| arg.start_with?("file://") }
if (fetch_args.-(ARGV).empty? || clone_args.-(ARGV).empty?) && File.exist?(ARGV[ARGV.index("--") + 1])
warn "git remote ops have been disabled"
exit 1
end

Просмотреть файл

@ -14,6 +14,19 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}"
end
it "displays the revision hash of the gem repository when passed a relative local path" do
build_git "foo", "1.0", path: lib_path("foo")
relative_path = lib_path("foo").relative_path_from(bundled_app)
install_gemfile <<-G, verbose: true
source "https://gem.repo1"
gem "foo", :git => "#{relative_path}"
G
expect(out).to include("Using foo 1.0 from #{relative_path} (at main@#{revision_for(lib_path("foo"))[0..6]})")
expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}"
end
it "displays the correct default branch", git: ">= 2.28.0" do
build_git "foo", "1.0", path: lib_path("foo"), default_branch: "main"