doctor: make git status check saner

The order of things made the check for git in the path pointless (and
was my fault); this is a better way to do it.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-03-01 23:29:14 -06:00
parent 2d5de8c7ed
commit caa3c4f864

View File

@ -732,9 +732,9 @@ def check_missing_deps
end end
def check_git_status def check_git_status
return unless system "/usr/bin/which -s git"
HOMEBREW_REPOSITORY.cd do HOMEBREW_REPOSITORY.cd do
cmd = `git status -s Library/Homebrew/ 2> /dev/null`.chomp unless `git status -s -- Library/Homebrew/ 2>/dev/null`.chomp.empty? then <<-EOS.undent
if system "/usr/bin/which -s git" and File.directory? '.git' and not cmd.empty? then <<-EOS.undent
You have uncommitted modifications to Homebrew's core. You have uncommitted modifications to Homebrew's core.
Unless you know what you are doing, you should run: Unless you know what you are doing, you should run:
cd #{HOMEBREW_REPOSITORY} && git reset --hard cd #{HOMEBREW_REPOSITORY} && git reset --hard