aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2011-10-10 18:20:50 -0500
committerJack Nagel2011-10-10 18:20:50 -0500
commit658b895c36bf9b187e5e716c541dbb0f088e25cc (patch)
treedfccc552e6e857c7c74d15cb6a0091e1dc197b76
parentcaf5984f96c54a4952be1084c720cc733e7d05c7 (diff)
downloadhomebrew-658b895c36bf9b187e5e716c541dbb0f088e25cc.tar.bz2
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>
-rw-r--r--Library/Homebrew/cmd/doctor.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 02fdce888..339a7a72c 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -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