aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2011-09-11 11:06:00 -0500
committerJack Nagel2011-09-11 11:12:08 -0500
commit1cf80272fc5982a8d468ddc0ee8f1c9b34c99f28 (patch)
tree6b9dd2e121c07e2d8955354ec5b21695ebdf2837 /Library
parent18a553d0e7a376eb043d078ffb86dc098b3e2974 (diff)
downloadhomebrew-1cf80272fc5982a8d468ddc0ee8f1c9b34c99f28.tar.bz2
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 <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/doctor.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 743c94fa5..7b5549f63 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