doctor: update git version check

This commit is contained in:
Jack Nagel 2013-05-07 19:22:21 -05:00
parent 66489b70d7
commit 14bc883750

View File

@ -1,4 +1,5 @@
require 'cmd/missing' require 'cmd/missing'
require 'version'
class Volumes class Volumes
def initialize def initialize
@ -916,13 +917,14 @@ def check_for_leopard_ssl
end end
def check_git_version def check_git_version
# see https://github.com/blog/642-smart-http-support # https://help.github.com/articles/https-cloning-errors
return unless which "git" return unless which "git"
`git --version`.chomp =~ /git version (\d)\.(\d)\.(\d)/
if $2.to_i < 6 or $2.to_i == 6 and $3.to_i < 6 then <<-EOS.undent `git --version`.chomp =~ /git version ((?:\d+\.?)+)/
if Version.new($1) < Version.new("1.7.10") then <<-EOS.undent
An outdated version of Git was detected in your PATH. 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. Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git Please upgrade: brew upgrade git
EOS EOS
end end