From 627a8463a6405c78453d2b56dc6582f6aa1c3e58 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 11 Sep 2011 11:06:00 -0500 Subject: [PATCH] doctor: be more robust about git status check `git status -s` would spit out "fatal: not a git repository" when not in HOMEBREW_PREFIX or a child directory of HOMEBREW_PREFIX. Specify a git-dir and work-tree to fix this. Signed-off-by: Jack Nagel --- Library/Homebrew/cmd/doctor.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 743c94fa59..7b5549f630 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -750,7 +750,8 @@ def check_missing_deps end def check_git_status - if system "/usr/bin/which -s git" and not `git status -s #{HOMEBREW_PREFIX}/Library/Homebrew`.empty? + 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? ohai "You have uncommitted modifications to Homebrew core" puts "Unless you know what you are doing, you should: git reset --hard" end