mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 08:25:20 +08:00
[ruby/rubygems] Rewrite the OVERRIDES section without resolving again
An override change made the lockfile count as needing resolution, so `bundle install` fetched the remote index and failed offline when the compact index cache was absent, and `Bundler.setup` re-resolved on boot. The section only needs to be regenerated, which #write_lock already does when the contents differ, and the frozen check still reports the change. https://github.com/ruby/rubygems/commit/a616f3d1bb Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
12ebde9bf1
commit
aed528a95c
2 files changed
+23
-3
No files matched your search
@@ -667,8 +667,7 @@ module Bundler
|
||||
@locked_spec_with_missing_checksums ||
|
||||
empty_checksums_actionable? ||
|
||||
@locked_spec_with_missing_deps ||
|
||||
@locked_spec_with_invalid_deps ||
|
||||
@override_changes
|
||||
@locked_spec_with_invalid_deps
|
||||
end
|
||||
|
||||
def resolve_needed?
|
||||
@@ -920,6 +919,8 @@ module Bundler
|
||||
else
|
||||
lockfile_changed_reason
|
||||
end
|
||||
elsif @override_changes
|
||||
"the overrides in your gemfile changed"
|
||||
else
|
||||
"some dependencies were deleted from your gemfile"
|
||||
end
|
||||
@@ -1160,7 +1161,9 @@ module Bundler
|
||||
|
||||
# The lockfile records the Gemfile's overrides, so a change to them is a
|
||||
# change to the lockfile even when every locked version still satisfies
|
||||
# them.
|
||||
# them. Rewriting the section needs no resolution, so this stays out of
|
||||
# #something_changed?. #write_lock rewrites it because the generated
|
||||
# contents differ, and the frozen check reports it.
|
||||
def converge_overrides
|
||||
return false unless @locked_gems
|
||||
|
||||
|
||||
@@ -281,6 +281,23 @@ RSpec.describe "override DSL" do
|
||||
expect(lockfile).to include("myrack (1.0.0)")
|
||||
end
|
||||
|
||||
it "records an override change without fetching from the source" do
|
||||
install_gemfile <<-G
|
||||
source "https://gem.repo1"
|
||||
gem "myrack"
|
||||
G
|
||||
|
||||
gemfile <<-G
|
||||
source "https://gem.repo1"
|
||||
override :all, required_ruby_version: :ignore_upper
|
||||
gem "myrack"
|
||||
G
|
||||
|
||||
FileUtils.rm_rf(compact_index_cache_path)
|
||||
bundle :install, artifice: "fail"
|
||||
expect(lockfile).to include("OVERRIDES\n :all, required_ruby_version: :ignore_upper\n")
|
||||
end
|
||||
|
||||
it "treats equivalent requirement spellings as the same override" do
|
||||
install_gemfile <<-G
|
||||
source "https://gem.repo1"
|
||||
|
||||
Reference in new issue
Block a user