From c1fb7a8e4ab896c73b95351b215b123c50e407f6 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 12 Jun 2015 13:26:46 +0800 Subject: [PATCH] tap_paths: prevent conflicted formulae happen in the same tap Closes Homebrew/homebrew#40606. Signed-off-by: Xu Cheng --- Library/Homebrew/formulary.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index cc59b34728..72024642cf 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -244,8 +244,11 @@ class Formulary def self.tap_paths(name) name = name.downcase Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"].map do |tap| - Pathname.glob(["#{tap}#{name}.rb", "#{tap}Formula/#{name}.rb", - "#{tap}HomebrewFormula/#{name}.rb"]) - end.flatten.select(&:file?) + Pathname.glob([ + "#{tap}Formula/#{name}.rb", + "#{tap}HomebrewFormula/#{name}.rb", + "#{tap}#{name}.rb", + ]).detect(&:file?) + end.compact end end