From 3718a60c9021eb01ccb721db1c95fe245f514806 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Thu, 12 May 2011 08:47:51 -0700 Subject: [PATCH] brew doctor: find suspicious git newline configs --- Library/Homebrew/cmd/doctor.rb | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 526747b57f..c9a62111b0 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -538,13 +538,35 @@ def check_for_git Homebrew uses Git for several internal functions, and some formulae use Git checkouts instead of stable tarballs. - You may want to do: + You may want to install git: brew install git EOS end end +def check_git_newline_settings + git = `/usr/bin/which git`.chomp + return if git.empty? + + autocrlf=`git config --get core.autocrlf` + safecrlf=`git config --get core.safecrlf` + + if autocrlf=='input' and safecrlf=='true' + puts <<-EOS.undent + Suspicious Git newline settings found. + + The detected Git newline settings can cause checkout problems: + core.autocrlf=#{autocrlf} + core.safecrlf=#{safecrlf} + + If you are not routinely dealing with Windows-based projects, + consider removing these settings. + + EOS + end +end + def check_for_autoconf which_autoconf = `/usr/bin/which autoconf`.chomp unless (which_autoconf == '/usr/bin/autoconf' or which_autoconf == '/Developer/usr/bin/autoconf') @@ -709,6 +731,7 @@ module Homebrew extend self check_for_symlinked_cellar check_for_multiple_volumes check_for_git + check_git_newline_settings check_for_autoconf check_for_linked_kegonly_brews check_for_other_frameworks