summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2024-08-27 23:35:43 +0200
committergit <svn-admin@ruby-lang.org>2024-08-30 10:16:29 +0000
commit08b92b67ffdfbfaf53974457308b719f6e2d0d24 (patch)
treeff117bb34a7a1c058e04a8e9ac5d22d33a4468e7
parent63287fef9c3290a1e11b5e83bff648b385ad80ee (diff)
[rubygems/rubygems] Don't blow up when explicit version is removed from some git sources
`version` is actually an attribute of the dependency, not of the git source. Sometimes it's passed to the git source to be able to fake a gemspec in case there's no gemspec in the source, but it should not be used for source comparison. https://github.com/rubygems/rubygems/commit/d936fbd78e
-rw-r--r--lib/bundler/source/git.rb4
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb19
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 9ce74adc2c..08a41a59ba 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -70,13 +70,13 @@ module Bundler
end
def hash
- [self.class, uri, ref, branch, name, version, glob, submodules].hash
+ [self.class, uri, ref, branch, name, glob, submodules].hash
end
def eql?(other)
other.is_a?(Git) && uri == other.uri && ref == other.ref &&
branch == other.branch && name == other.name &&
- version == other.version && glob == other.glob &&
+ glob == other.glob &&
submodules == other.submodules
end
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index d76a33f076..a544080fe6 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -1107,6 +1107,25 @@ RSpec.describe "bundle install with git sources" do
run "require 'new_file'"
expect(out).to eq("USING GIT")
end
+
+ it "doesn't explode when removing an explicit exact version from a git gem with dependencies" do
+ build_lib "activesupport", "7.1.4", path: lib_path("rails/activesupport")
+ build_git "rails", "7.1.4", path: lib_path("rails") do |s|
+ s.add_dependency "activesupport", "= 7.1.4"
+ end
+
+ install_gemfile <<-G
+ source "https://gem.repo1"
+ gem "rails", "7.1.4", :git => "#{lib_path("rails")}"
+ G
+
+ install_gemfile <<-G
+ source "https://gem.repo1"
+ gem "rails", :git => "#{lib_path("rails")}"
+ G
+
+ expect(the_bundle).to include_gem "rails 7.1.4", "activesupport 7.1.4"
+ end
end
describe "bundle install after the remote has been updated" do