upgrade: address @MikeMcQuaid's comments

This commit is contained in:
L. E. Segovia 2019-10-12 22:06:08 +00:00
parent f4707a8041
commit 024007f9e2
No known key found for this signature in database
GPG Key ID: 2EA9E1FDA820A9F1

View File

@ -255,7 +255,7 @@ module Homebrew
[formulae_to_upgrade, formulae_pinned]
end
def broken_dependents(kegs, formulae, scanned = [])
def broken_dependents(kegs, formulae, scanned = Set.new)
formulae_to_reinstall = Set.new
formulae_pinned_and_outdated = Set.new
@ -264,10 +264,9 @@ module Homebrew
descendants = Set.new
dependents = kegs.select do |keg|
keg.runtime_dependencies
.any? { |d| d["full_name"] == formula.full_name }
end.reject do |keg|
scanned.include?(keg)
keg = keg.runtime_dependencies
.any? { |d| d["full_name"] == formula.full_name }
keg unless scanned.include?(keg)
end
next if dependents.empty?
@ -292,7 +291,7 @@ module Homebrew
descendants << f
end
scanned << dependents
scanned.merge dependents
descendants_to_reinstall, descendants_pinned = broken_dependents(kegs, descendants, scanned)