From e59cc08809239e6e752c26113321b63822525c8e Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Mon, 14 Nov 2011 08:22:59 -0800 Subject: [PATCH] Hotfix for filtered_args breaking brew upgrade The `filtered_args` method added to the `FormulaInstaller` makes a call `ARGV.formulae`. Unfortunately, `ARGV.formulae` will throw a `FormulaUnspecifiedError` instead of returning an empty list. This patch avoids the issue by checking `ARGV.named.empty?` before calling `ARGV.formulae`. Fixes #8576. --- Library/Homebrew/formula_installer.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 537cbd31764b..689c4ff68fc4 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -247,7 +247,16 @@ def check_m4 def filtered_args # Did the user actually pass the formula this installer is considering on # the command line? - def explicitly_requested?; ARGV.formulae.include? f end + def explicitly_requested? + # `ARGV.formulae` will throw an exception if it comes up with an empty + # list. + # + # FIXME: + # `ARGV.formulae` probably should be throwing exceptions, it should be + # the caller's responsibility to check `ARGV.formulae.empty?`. + return false if ARGV.named.empty? + ARGV.formulae.include? f + end previous_install = Tab.for_formula f args = ARGV.clone