aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-08-24 23:08:56 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-08-25 18:34:47 +0900
commit023b8ddd220f2451b51490ee2e48dedb211e2d1b (patch)
treeb44295481643b20fdde0fd6696e42858b8abfe61 /lib/bundler/source
parentb5d03746359c1e316e0f69742353b2ea74230283 (diff)
downloadruby-023b8ddd220f2451b51490ee2e48dedb211e2d1b.tar.gz
[rubygems/rubygems] Don't use full indexes unnecessarily on legacy Gemfiles
On legacy Gemfiles with multiple remote sources, where all of them support the compact index API, we were still falling back to full indexes. Fixing this also allows to simplifying the code. https://github.com/rubygems/rubygems/commit/b1357c8e72
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/rubygems.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index af57acbbc2..9790753204 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -399,16 +399,11 @@ module Bundler
@remote_specs ||= Index.build do |idx|
index_fetchers = fetchers - api_fetchers
- # gather lists from non-api sites
- fetch_names(index_fetchers, nil, idx, false)
-
- # legacy multi-remote sources need special logic to figure out
- # dependency names and that logic can be very costly if one remote
- # uses the dependency API but others don't. So use full indexes
- # consistently in that particular case.
- allow_api = !multiple_remotes?
-
- fetch_names(api_fetchers, allow_api && dependency_names, idx, false)
+ if index_fetchers.empty?
+ fetch_names(api_fetchers, dependency_names, idx, false)
+ else
+ fetch_names(fetchers, nil, idx, false)
+ end
end
end