keg: don't return nil dependencies
This is a proper fix to the problem addressed by #1510. The problem arises when f_kegs is nil, which can happen if the name and tap used to install a keg don't match the name and tap currently associated with its formula (i.e. if it's been renamed or moved).
This commit is contained in:
parent
49310667b4
commit
fb920668c8
@ -119,7 +119,7 @@ class Keg
|
||||
next unless f_kegs
|
||||
|
||||
f_kegs.sort_by(&:version).last
|
||||
end
|
||||
end.compact
|
||||
|
||||
next unless required_kegs.any?
|
||||
|
||||
|
@ -369,6 +369,19 @@ class InstalledDependantsTests < LinkTestCase
|
||||
assert_equal [[@keg], ["bar 1.0"]], Keg.find_some_installed_dependents([@keg])
|
||||
end
|
||||
|
||||
def test_a_dependency_with_no_tap_in_tab
|
||||
@tap_dep = setup_test_keg("baz", "1.0")
|
||||
|
||||
alter_tab(@keg) { |t| t.source["tap"] = nil }
|
||||
|
||||
dependencies nil
|
||||
Formula["bar"].class.depends_on "foo"
|
||||
Formula["bar"].class.depends_on "baz"
|
||||
|
||||
result = Keg.find_some_installed_dependents([@keg, @tap_dep])
|
||||
assert_equal [[@tap_dep], ["bar"]], result
|
||||
end
|
||||
|
||||
def test_no_dependencies_anywhere
|
||||
dependencies nil
|
||||
assert_empty @keg.installed_dependents
|
||||
|
Loading…
x
Reference in New Issue
Block a user