diff options
| author | Xu Cheng | 2016-03-15 16:55:58 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-03-21 19:07:38 +0800 |
| commit | 8ca79a6df59a7d02ee379e5a766e9170bb26c797 (patch) | |
| tree | ac36affde5c9dece28642afde21bfd50566eabb0 /Library/ENV | |
| parent | ce7b32cec835bb658df75a0c691db9a97921163c (diff) | |
| download | brew-8ca79a6df59a7d02ee379e5a766e9170bb26c797.tar.bz2 | |
scm/git: handle no Xcode/CLT configuration
`/usr/bin/<tool>` will be a popup stub under such configuration.
The idea is to let `scm/git` to handle all of git location resolution
throughout Homebrew codebase.
Diffstat (limited to 'Library/ENV')
| -rwxr-xr-x | Library/ENV/scm/git | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Library/ENV/scm/git b/Library/ENV/scm/git index 6d13a33a3..05148339a 100755 --- a/Library/ENV/scm/git +++ b/Library/ENV/scm/git @@ -10,8 +10,8 @@ fi exec "$HOMEBREW_RUBY_PATH" -x "$0" "$@" #!/usr/bin/env ruby -W0 -# This script because we support $GIT, $HOMEBREW_SVN, etc. and Xcode-only -# configurations. Order is careful to be what the user would want. +# This script because we support $GIT, $HOMEBREW_SVN, etc., Xcode-only and +# no Xcode/CLT configurations. Order is careful to be what the user would want. F = File.basename(__FILE__).freeze D = File.expand_path(File.dirname(__FILE__)).freeze @@ -35,17 +35,26 @@ brew_version = File.expand_path("#{D}/../../../bin/#{F}") exec brew_version, *ARGV if File.executable? brew_version `/usr/bin/which -a #{F} 2>/dev/null`.split("\n").each do |path| - exec path, *ARGV + exec path, *ARGV unless path == "/usr/bin/#{F}" end -# xcrun hangs if xcode-select is set to "/" -path = `/usr/bin/xcode-select -print-path 2>/dev/null`.chomp -if path != "/" - path = `/usr/bin/xcrun -find #{F} 2>/dev/null`.chomp - exec path, *ARGV if File.executable? path +popup_stub = false +if File.executable? "/usr/bin/xcode-select" + # xcode-select will return empty on no Xcode/CLT configuration. + # /usr/bin/<tool> will be a popup stub under such configuration. + # xcrun hangs if xcode-select is set to "/" + path = `/usr/bin/xcode-select -print-path 2>/dev/null`.chomp + popup_stub = path.empty? + if !popup_stub && path != "/" + path = `/usr/bin/xcrun -find #{F} 2>/dev/null`.chomp + exec path, *ARGV if File.executable? path + end end path = "/Applications/Xcode.app/Contents/Developer/usr/bin/#{F}" exec path, *ARGV if File.executable? path +path = "/usr/bin/#{F}" +exec path, *ARGV if !popup_stub && File.executable?(path) + abort "You must: brew install #{F}" |
