Skip to content
Snippets Groups Projects
Commit fb920668 authored by Alyssa Ross's avatar Alyssa Ross
Browse files

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).
parent 49310667
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment