Skip to content
This repository has been archived by the owner. It is now read-only.

Add :glob to git source uniqueness #7419

Merged
1 commit merged into from Nov 26, 2019

Conversation

fatkodima
Copy link
Contributor

@fatkodima fatkodima commented Nov 3, 2019

Closes #7346

@deivid-rodriguez
Copy link
Member

deivid-rodriguez commented Nov 20, 2019

The test here is incorrect, but the fix looks good. The test should be modified like this to actually catch the issue:

diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index 93b90a705..2ce5ddf15 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -64,18 +64,19 @@ RSpec.describe "bundle install" do
 
     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")
+        build_lib "foo", "1.0", :path => lib_path("gems/foo")
+        build_lib "zebra", "2.0", :path => lib_path("gems/zebra")
+        build_git "gems", :path => lib_path("gems"), :gemspec => false
       end
 
       install_gemfile <<-G
         source "#{file_uri_for(gem_repo2)}"
-        gem "foo", :git => "#{lib_path("foo")}"
-        gem "zebra", :git => "#{lib_path("zebra")}"
+        gem "foo", :git => "#{lib_path("gems")}", :glob => "foo/*.gemspec"
+        gem "zebra", :git => "#{lib_path("gems")}", :glob => "zebra/*.gemspec"
       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]})")
+      expect(out).to include("Using foo 1.0 from #{lib_path("gems")} (at master@#{revision_for(lib_path("gems"))[0..6]})")
+      expect(out).to include("Using zebra 2.0 from #{lib_path("gems")} (at master@#{revision_for(lib_path("gems"))[0..6]})")
     end
   end
 end

@fatkodima
Copy link
Contributor Author

fatkodima commented Nov 20, 2019

@deivid-rodriguez Updated with your suggestion.

@deivid-rodriguez
Copy link
Member

deivid-rodriguez commented Nov 21, 2019

Ok! Now I see that CI is failing in Bundler 3 mode because bundler 3 will no longer print "Using" messages to screen on bundle install, unless the dependency has changed, so the assertions are failing.

You can test the same thing in another way with something like:

diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index 93b90a705..3bc8e1c06 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -74,8 +74,11 @@ RSpec.describe "bundle install" do
         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]})")
+      bundle "info foo"
+      expect(out).to include("* foo (1.0 #{revision_for(lib_path("foo"))[0..6]})")
+
+      bundle "info zebra"
+      expect(out).to include("* zebra (2.0 #{revision_for(lib_path("zebra"))[0..6]})")
     end
   end
 end

On a side note, I think we might want to still print the "Using" messages on the first bundle install, since technically, the dependency has changed in this case (from none to something). I'll open a separate issue to discuss this.

@fatkodima
Copy link
Contributor Author

fatkodima commented Nov 21, 2019

@deivid-rodriguez Got it. Updated.

@deivid-rodriguez
Copy link
Member

deivid-rodriguez commented Nov 26, 2019

@bundlerbot merge

@deivid-rodriguez deivid-rodriguez added this to the 2.1.0.rc milestone Nov 26, 2019
ghost pushed a commit that referenced this issue Nov 26, 2019
7419: Add :glob to git source uniqueness r=deivid-rodriguez a=fatkodima

Closes #7346

Co-authored-by: fatkodima <fatkodima123@gmail.com>
@ghost
Copy link

ghost commented Nov 26, 2019

Build succeeded

@ghost ghost merged commit 5c93791 into rubygems:master Nov 26, 2019
3 checks passed
@deivid-rodriguez deivid-rodriguez modified the milestones: 2.1.0.rc, 2.1.0 Dec 13, 2019
deivid-rodriguez pushed a commit that referenced this issue Dec 13, 2019
7419: Add :glob to git source uniqueness r=deivid-rodriguez a=fatkodima

Closes #7346

Co-authored-by: fatkodima <fatkodima123@gmail.com>
(cherry picked from commit 87449d5)
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants