[rubygems/rubygems] Reduce excess index creation and merging

When @allow_cached is true, @allow_local is always true,
therefore, the #installed_specs will always be merged after #cached_specs
is called. This makes starting with installed_specs.dup redundant.

When #cached_specs is called because @allow_remote is true and
@allow_cached is false, then installed_specs will be added after
cached_specs based on @allow_local.

We never need to add installed_specs here, so don't.

https://github.com/rubygems/rubygems/commit/49b38f9750
This commit is contained in:
Martin Emde 2023-08-31 21:38:52 -07:00 committed by git
parent 86b93f7481
commit 89cb95679d

View File

@ -380,7 +380,7 @@ module Bundler
def cached_specs
@cached_specs ||= begin
idx = @allow_local ? installed_specs.dup : Index.new
idx = Index.new
Dir["#{cache_path}/*.gem"].each do |gemfile|
s ||= Bundler.rubygems.spec_from_gem(gemfile)