doctor: only check git status if repository exists

Closes Homebrew/homebrew#7722.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2011-09-19 21:47:17 -05:00
parent 28aef26a47
commit d817e5e51e

View File

@ -753,7 +753,7 @@ end
def check_git_status
status_cmd = "git --git-dir=#{HOMEBREW_REPOSITORY}/.git --work-tree=#{HOMEBREW_PREFIX} status -s #{HOMEBREW_PREFIX}/Library/Homebrew"
if system "/usr/bin/which -s git" and not `#{status_cmd}`.empty?
if system "/usr/bin/which -s git" and File.directory? HOMEBREW_REPOSITORY+'.git' and not `#{status_cmd}`.empty?
ohai "You have uncommitted modifications to Homebrew core"
puts "Unless you know what you are doing, you should: git reset --hard"
puts