diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 30cf94e13f..d0da09575c 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -258,7 +258,8 @@ EOS if ! git --version >/dev/null 2>&1 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 then odie "Git must be installed and in your PATH!" diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 21bb7695ce..25dc49b02c 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -7,6 +7,11 @@ module Utils def self.ensure_git_installed! return if git_available? + # we cannot install brewed git if homebrew/core is unavailable. + unless CoreTap.instance.installed? + raise "Git is unavailable" + end + begin oh1 "Installing git" safe_system HOMEBREW_BREW_FILE, "install", "git"