From a699eeb468956446d9ae7e71df7deaf7d214844b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 24 Apr 2014 20:45:36 -0500 Subject: [PATCH] Don't use a regexp to match paths, just compare them for equality --- Library/Homebrew/cmd/untap.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 8d58e2a5b3..e013b5ca68 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -30,13 +30,12 @@ module Homebrew extend self gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] formulae.each do |formula| - tapd = (HOMEBREW_LIBRARY/"Taps/#{formula}").dirname - bn = formula.basename.to_s - pn = HOMEBREW_LIBRARY/"Formula/#{bn}" + file = HOMEBREW_LIBRARY.join("Taps", formula) + link = HOMEBREW_LIBRARY.join("Formula", formula.basename) - if pn.symlink? and (!pn.exist? or pn.realpath.to_s =~ %r[^#{tapd}]) - pn.delete - gitignores.delete(bn) + if link.symlink? && (!link.exist? || link.resolved_path == file) + link.delete + gitignores.delete(file.basename.to_s) untapped += 1 end end