Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundler/lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ def converge_specs(specs)
end
end

if parent_dep && parent_dep.source.is_a?(Source::Path)
if parent_dep && parent_dep.source.is_a?(Source::Path) && parent_dep.source.specs[s]&.any?
replacement_source = parent_dep.source
else
replacement_source = sources.get(lockfile_source)
Expand Down
74 changes: 74 additions & 0 deletions bundler/spec/install/gemfile/sources_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1236,4 +1236,78 @@
expect(the_bundle).to include_gems("fallback_dep 1.0.0", source: "remote2")
end
end

context "when a path gem has a transitive dependency that does not exist in the path source" do
before do
build_repo2 do
build_gem "missing_dep", "1.0.0"
build_gem "foo", "1.0.0"
end

build_lib "parent_gem", "1.0.0", path: lib_path("parent_gem") do |s|
s.add_dependency "missing_dep"
end

gemfile <<-G
source "https://gem.repo2"

gem "foo"

gem "parent_gem", path: "#{lib_path("parent_gem")}"
G

bundle :install, artifice: "compact_index"
end

it "falls back to the default rubygems source for that dependency when updating" do
build_repo2 do
build_gem "foo", "2.0.0"
end

system_gems []

bundle "update foo", artifice: "compact_index"

expect(the_bundle).to include_gems("parent_gem 1.0.0", "missing_dep 1.0.0", "foo 2.0.0")
expect(the_bundle).to include_gems("parent_gem 1.0.0", source: "path@#{lib_path("parent_gem")}")
expect(the_bundle).to include_gems("missing_dep 1.0.0", source: "remote2")
end
end

context "when a git gem has a transitive dependency that does not exist in the git source" do
before do
build_repo2 do
build_gem "missing_dep", "1.0.0"
build_gem "foo", "1.0.0"
end

build_git "parent_gem", "1.0.0", path: lib_path("parent_gem") do |s|
s.add_dependency "missing_dep"
end

gemfile <<-G
source "https://gem.repo2"

gem "foo"

gem "parent_gem", git: "#{lib_path("parent_gem")}"
G

bundle :install, artifice: "compact_index"
end

it "falls back to the default rubygems source for that dependency when updating" do
build_repo2 do
build_gem "foo", "2.0.0"
end

system_gems []

bundle "update foo", artifice: "compact_index"

expect(the_bundle).to include_gems("parent_gem 1.0.0", "missing_dep 1.0.0", "foo 2.0.0")
expect(the_bundle).to include_gems("parent_gem 1.0.0", source: "git@#{lib_path("parent_gem")}")
expect(the_bundle).to include_gems("missing_dep 1.0.0", source: "remote2")
end
end
end