[前][次][番号順一覧][スレッド一覧]

ruby-changes:69821

From: David <ko1@a...>
Date: Fri, 19 Nov 2021 10:12:20 +0900 (JST)
Subject: [ruby-changes:69821] 2730e45f45 (master): [rubygems/rubygems] Avoid unnecessary loop

https://git.ruby-lang.org/ruby.git/commit/?id=2730e45f45

From 2730e45f4565ef41a08d2694be2a287c86f9e0ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Tue, 16 Nov 2021 15:01:18 +0100
Subject: [rubygems/rubygems] Avoid unnecessary loop

https://github.com/rubygems/rubygems/commit/afaf868b68
---
 lib/bundler/definition.rb | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 59ce07352a2..d0ae4631d71 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -691,21 +691,15 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L691
     # 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 https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L757
       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)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]