From e65649aeb045bbc4529513b989a909cc13fed358 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 18 Dec 2011 09:57:15 -0800 Subject: [PATCH] --HEAD checks * Force --HEAD for head-only installs * Don't allow --HEAD for stable-only formulae --- Library/Homebrew/cmd/install.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index a7b3dc0f98..735db6107c 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -88,6 +88,16 @@ module Homebrew extend self # command line may have been installed to satisfy a dependency. next if f.installed? unless ARGV.force? + # Building head-only without --HEAD is an error + if not ARGV.build_head? and f.stable.nil? + raise "This is a head-only formula; install with `brew install --HEAD #{f.name}`" + end + + # Building stable-only with --HEAD is an error + if ARGV.build_head? and f.unstable.nil? + raise "No head is defined for #{f.name}" + end + begin fi = FormulaInstaller.new(f) fi.install