From 93db2aa37ec55d1196eedf531eac09c1c7b2fd39 Mon Sep 17 00:00:00 2001 From: fatkodima Date: Sun, 3 Nov 2019 01:10:53 +0200 Subject: [PATCH] Add :glob to git source uniqueness --- lib/bundler/source/git.rb | 7 ++++--- spec/install/git_spec.rb | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 736f5bb5465..fcb0ce8e0e1 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -8,7 +8,7 @@ class Source class Git < Path autoload :GitProxy, File.expand_path("git/git_proxy", __dir__) - attr_reader :uri, :ref, :branch, :options, :submodules + attr_reader :uri, :ref, :branch, :options, :glob, :submodules def initialize(options) @options = options @@ -48,13 +48,14 @@ def to_lock end def hash - [self.class, uri, ref, branch, name, version, submodules].hash + [self.class, uri, ref, branch, name, version, 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 && submodules == other.submodules + version == other.version && glob == other.glob && + submodules == other.submodules end alias_method :==, :eql? diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index c16285241fa..93b90a7051c 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -61,5 +61,21 @@ expect(out).to include("Bundle complete!") end + + it "allows multiple gems from the same git source" do + build_repo2 do + build_git "foo", "1.0", :path => lib_path("foo") + build_git "zebra", "2.0", :path => lib_path("zebra") + end + + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "foo", :git => "#{lib_path("foo")}" + gem "zebra", :git => "#{lib_path("zebra")}" + G + + expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master@#{revision_for(lib_path("foo"))[0..6]})") + expect(out).to include("Using zebra 2.0 from #{lib_path("zebra")} (at master@#{revision_for(lib_path("zebra"))[0..6]})") + end end end