Skip to content

Commit

Permalink
[rubygems/rubygems] Don't re-resolve with prereleases if unlocked gem…
Browse files Browse the repository at this point in the history
… has no prereleases

rubygems/rubygems@d76dc70d90
  • Loading branch information
deivid-rodriguez authored and matzbot committed Oct 3, 2023
1 parent b73ef92 commit ed0661e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/resolver.rb
Expand Up @@ -131,7 +131,7 @@ def find_names_to_relax(incompatibility)

if base_requirements[name]
names_to_unlock << name
elsif package.ignores_prereleases?
elsif package.ignores_prereleases? && @all_specs[name].any? {|s| s.version.prerelease? }
names_to_allow_prereleases_for << name
end

Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/realworld/edgecases_spec.rb
Expand Up @@ -323,7 +323,7 @@ def rubygems_version(name, requirement)
if Bundler.feature_flag.bundler_3_mode?
# Conflicts on bundler version, so we count attempts differently
bundle :lock, :env => { "DEBUG_RESOLVER" => "1" }, :raise_on_error => false
expect(out.split("\n").grep(/backtracking to/).count).to eq(16)
expect(out.split("\n").grep(/backtracking to/).count).to eq(8)
else
bundle :lock, :env => { "DEBUG_RESOLVER" => "1" }
expect(out).to include("Solution found after 7 attempts")
Expand Down
9 changes: 9 additions & 0 deletions spec/bundler/resolver/basic_spec.rb
Expand Up @@ -107,6 +107,15 @@
end.to raise_error(Bundler::SolveFailure)
end

it "does not try to re-resolve including prereleases if gems involved don't have prereleases" do
@index = a_unresolvable_child_index
dep "chef_app_error"
expect(Bundler.ui).not_to receive(:debug).with("Retrying resolution...", any_args)
expect do
resolve
end.to raise_error(Bundler::SolveFailure)
end

it "raises an exception with the minimal set of conflicting dependencies" do
@index = build_index do
%w[0.9 1.0 2.0].each {|v| gem("a", v) }
Expand Down

0 comments on commit ed0661e

Please sign in to comment.