From f88fbf1882b1d4e74a0f36e561f5f4955af424f0 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Mon, 18 Jan 2010 08:26:25 +0000 Subject: [PATCH] Don't cleanup if we can't tell which formula is for keeps If the formula was updated and not yet installed, then cleanup would delete all kegs. Which is most likely not what the user wanted. Ideally we'd do a version check to figure out which keg is newest. But we don't yet have a function that can determine with accuracy version order. --- Library/Homebrew/brew.h.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index 55a416c095..6a284b2921 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -250,6 +250,9 @@ def cleanup name f = Formula.factory name + # we can't tell which one to keep in this circumstance + raise "The most recent version of #{name} is not installed" unless f.installed? + if f.prefix.parent.directory? kids = f.prefix.parent.children kids.each do |keg|