Skip to content

Commit

Permalink
[rubygems/rubygems] Fix error when changing a path source to a git so…
Browse files Browse the repository at this point in the history
…urce if frozen mode

rubygems/rubygems@4c79ab9b2e
  • Loading branch information
deivid-rodriguez authored and matzbot committed Sep 30, 2024
1 parent 1e00763 commit 3a273c4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/bundler/source/path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def to_s
"source at `#{@path}`"
end

alias_method :to_gemfile, :path

def hash
[self.class, expanded_path, version].hash
end
Expand Down
21 changes: 21 additions & 0 deletions spec/bundler/install/deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,27 @@
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

Expand Down

0 comments on commit 3a273c4

Please sign in to comment.