From e12c23faa87aa9c6f493dcd4aa47d1124c41a418 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 18 Sep 2016 23:59:55 +0100 Subject: [PATCH] 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. --- Library/Homebrew/formula.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 5368941f74..795646d08e 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1186,7 +1186,11 @@ class Formula end 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 # @private