summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-11-16 15:01:18 +0100
committergit <svn-admin@ruby-lang.org>2021-11-19 10:12:09 +0900
commit2730e45f4565ef41a08d2694be2a287c86f9e0ba (patch)
tree4805bbd0c41d3eafcd5c639c6e0666a1c220c954 /lib
parent4b1dd75e6c4308801156b4839662868be8676ff0 (diff)
[rubygems/rubygems] Avoid unnecessary loop
https://github.com/rubygems/rubygems/commit/afaf868b68
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/definition.rb20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 59ce07352a..d0ae4631d7 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -691,21 +691,15 @@ module Bundler
# generated
def converge_locked_specs
deps = []
-
- # Build a list of dependencies that are the same in the Gemfile
- # and Gemfile.lock. If the Gemfile modified a dependency, but
- # the gem in the Gemfile.lock still satisfies it, this is fine
- # too.
- @dependencies.each do |dep|
- if satisfies_locked_spec?(dep)
- deps << dep
- end
- end
-
converged = []
@locked_specs.each do |s|
# Replace the locked dependency's source with the equivalent source from the Gemfile
dep = @dependencies.find {|d| s.satisfies?(d) }
+
+ if dep && (!dep.source || s.source.include?(dep.source))
+ deps << dep
+ end
+
s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed?
# Don't add a spec to the list if its source is expired. For example,
@@ -763,10 +757,6 @@ module Bundler
resolve
end
- def satisfies_locked_spec?(dep)
- @locked_specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
- end
-
def metadata_dependencies
@metadata_dependencies ||= begin
ruby_versions = ruby_version_requirements(@ruby_version)