[rubygems/rubygems] Fix error when changing a path source to a git source if frozen mode

https://github.com/rubygems/rubygems/commit/4c79ab9b2e
This commit is contained in:
David Rodríguez 2024-09-27 07:27:12 +02:00 committed by git
parent 1e00763688
commit 3a273c4742
2 changed files with 23 additions and 0 deletions

View File

@ -53,6 +53,8 @@ module Bundler
"source at `#{@path}`"
end
alias_method :to_gemfile, :path
def hash
[self.class, expanded_path, version].hash
end

View File

@ -483,6 +483,27 @@ RSpec.describe "install in deployment or frozen mode" do
expect(err).not_to include("You have deleted from the Gemfile")
end
it "explodes if you change a source from path to git" do
build_git "myrack", path: lib_path("myrack")
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack", :path => "#{lib_path("myrack")}"
G
gemfile <<-G
source "https://gem.repo1"
gem "myrack", :git => "https:/my-git-repo-for-myrack"
G
bundle "config set --local frozen true"
bundle :install, raise_on_error: false
expect(err).to include("frozen mode")
expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack")}` to `https:/my-git-repo-for-myrack`")
expect(err).not_to include("You have added to the Gemfile")
expect(err).not_to include("You have deleted from the Gemfile")
end
it "remembers that the bundle is frozen at runtime" do
bundle :lock