git: check homebrew/core existence before installing brewed git

This commit is contained in:
Xu Cheng 2016-04-02 18:41:44 +08:00
parent deea4c82a4
commit 5560f5550d
2 changed files with 7 additions and 1 deletions

View File

@ -258,7 +258,8 @@ EOS
if ! git --version >/dev/null 2>&1 if ! git --version >/dev/null 2>&1
then then
brew install git # we cannot install brewed git if homebrew/core is unavailable.
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
if ! git --version >/dev/null 2>&1 if ! git --version >/dev/null 2>&1
then then
odie "Git must be installed and in your PATH!" odie "Git must be installed and in your PATH!"

View File

@ -7,6 +7,11 @@ module Utils
def self.ensure_git_installed! def self.ensure_git_installed!
return if git_available? return if git_available?
# we cannot install brewed git if homebrew/core is unavailable.
unless CoreTap.instance.installed?
raise "Git is unavailable"
end
begin begin
oh1 "Installing git" oh1 "Installing git"
safe_system HOMEBREW_BREW_FILE, "install", "git" safe_system HOMEBREW_BREW_FILE, "install", "git"