From 255c6e7c3fb34fbf8bd8899a051beec930fc7a4d Mon Sep 17 00:00:00 2001 From: Jack Nagel <jacknagel@gmail.com> Date: Sun, 26 May 2013 17:48:12 -0500 Subject: [PATCH] doctor: combine git existence and version checks --- Library/Homebrew/cmd/doctor.rb | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 5c9e1a9ae3..cff72a4256 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -687,8 +687,22 @@ def check_filesystem_case_sensitive EOS end +def __check_git_version + # https://help.github.com/articles/https-cloning-errors + `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. + Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub. + Please upgrade: brew upgrade git + EOS + end +end + def check_for_git - unless which "git" then <<-EOS.undent + if which "git" + __check_git_version + else <<-EOS.undent Git could not be found in your PATH. Homebrew uses Git for several internal functions, and some formulae use Git checkouts instead of stable tarballs. You may want to install Git: @@ -902,20 +916,6 @@ def check_for_leopard_ssl end end -def check_git_version - # https://help.github.com/articles/https-cloning-errors - return unless which "git" - - `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. - Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub. - Please upgrade: brew upgrade git - EOS - end -end - def check_for_enthought_python if which "enpkg" then <<-EOS.undent Enthought Python was found in your PATH. -- GitLab