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
4 changes: 3 additions & 1 deletion bundler/lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def for(dependencies, check = false, platforms = [nil])
incomplete = true
end

@incomplete_specs += lookup[name] if incomplete && check
if incomplete && check
@incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
end
end

specs
Expand Down
51 changes: 51 additions & 0 deletions bundler/spec/lock/lockfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,57 @@
and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.")
end

it "regenerates a lockfile with no specs" do
build_repo4 do
build_gem "indirect_dependency", "1.2.3" do |s|
s.metadata["funding_uri"] = "https://example.com/donate"
end

build_gem "direct_dependency", "4.5.6" do |s|
s.add_dependency "indirect_dependency", ">= 0"
end
end

lockfile <<-G
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:

PLATFORMS
ruby

DEPENDENCIES
direct_dependency

BUNDLED WITH
#{Bundler::VERSION}
G

install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"

gem "direct_dependency"
G

expect(lockfile).to eq <<~G
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
direct_dependency (4.5.6)
indirect_dependency
indirect_dependency (1.2.3)

PLATFORMS
#{lockfile_platforms}

DEPENDENCIES
direct_dependency

BUNDLED WITH
#{Bundler::VERSION}
G
end

it "auto-heals when the lockfile is missing dependent specs" do
build_repo4 do
build_gem "minitest-bisect", "1.6.0" do |s|
Expand Down