aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/index.rb7
-rw-r--r--lib/bundler/source.rb14
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 375bb276..22b0f6fc 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -78,10 +78,13 @@ module Bundler
end
end
- def use(other)
+ def use(other, override_dupes = false)
return unless other
other.each do |s|
- next if search_by_spec(s).any?
+ if (dupes = search_by_spec(s)) && dupes.any?
+ next unless override_dupes
+ @specs[s.name] -= dupes
+ end
@specs[s.name] << s
end
self
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index cf36e87f..eaa7bb65 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -158,11 +158,17 @@ module Bundler
end
def fetch_specs
- Index.build do |idx|
- idx.use installed_specs
- idx.use cached_specs if @allow_cached || @allow_remote
- idx.use remote_specs if @allow_remote
+ # remote_specs usually generates a way larger Index than the other
+ # sources, and large_idx.use small_idx is way faster than
+ # small_idx.use large_idx.
+ if @allow_remote
+ idx = remote_specs.dup
+ else
+ idx = Index.new
end
+ idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
+ idx.use(installed_specs, :override_dupes)
+ idx
end
def installed_specs