From 0ac3e83a7abbf0fe06206d4da145f2cd724b2a87 Mon Sep 17 00:00:00 2001
From: Max Howell <mxcl@me.com>
Date: Tue, 28 Aug 2012 09:52:13 -0400
Subject: [PATCH] Make `brew --prefix` very fast

Because people use this in .bash_profile etc. We should be as fast as possible.
---
 bin/brew | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bin/brew b/bin/brew
index 93fbbe9f2d..27596b22ee 100755
--- a/bin/brew
+++ b/bin/brew
@@ -5,6 +5,11 @@ std_trap = trap("INT") { exit! 130 } # no backtrace thanks
 
 HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)
 
+if ARGV == %w{--prefix}
+  puts File.dirname(File.dirname(HOMEBREW_BREW_FILE))
+  exit 0
+end
+
 require 'pathname'
 HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.dirname.parent.join("Library/Homebrew").to_s
 $:.unshift(HOMEBREW_LIBRARY_PATH + '/vendor')
-- 
GitLab