doctor: check git version

Checking out over HTTP/HTTPS from GitHub requires git 1.6.6, as GitHub
only allows Smart HTTP transport.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2011-10-10 18:20:50 -05:00
parent 0a49981a30
commit d73df34bc6

View File

@ -776,6 +776,28 @@ def check_for_leopard_ssl
end
end
def check_git_version
# see https://github.com/blog/642-smart-http-support
return unless system "/usr/bin/which -s git"
`git --version`.chomp =~ /git version (\d)\.(\d)\.(\d)/
if $2.to_i > 6
return
elsif $2.to_i == 6 and $3.to_i == 6
return
else
puts <<-EOS.undent
An outdated version of Git was detected in your PATH.
Git 1.6.6 or newer is required to perform checkouts over HTTP from GitHub.
You may want to upgrade:
brew upgrade git
EOS
end
end
module Homebrew extend self
def doctor
old_stdout = $stdout
@ -820,6 +842,7 @@ module Homebrew extend self
check_missing_deps
check_git_status
check_for_leopard_ssl
check_git_version
ensure
$stdout = old_stdout
end