Formula#old_installed_formula?: fix some bugs

Previously, this method would:

- Include the current formula
- Include the current target of the installed alias, which by definition
  is not "old"

This commit fixes both of these issues.
Only formulae that are the current target of the alias they were installed
with are now considered to have old installed formulae.
This commit is contained in:
Alyssa Ross 2016-09-18 23:59:55 +01:00
parent 912b8d4776
commit e12c23faa8

View File

@ -1186,7 +1186,11 @@ class Formula
end end
def old_installed_formulae def old_installed_formulae
alias_path ? self.class.installed_with_alias_path(alias_path) : [] # If this formula isn't the current target of the alias,
# it doesn't make sense to say that other formulae are older versions of it
# because we don't know which came first.
return [] if alias_path.nil? || installed_alias_target_changed?
self.class.installed_with_alias_path(alias_path) - [self]
end end
# @private # @private