diff options
| author | Jack Nagel | 2014-05-02 09:49:11 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-05-02 09:52:14 -0500 |
| commit | 5b6e0fb0cfef66e3762863cbf74219ed7c4321ec (patch) | |
| tree | 93a98bd7ee714afc7a45f7b5aae98a6e306c77f4 | |
| parent | 31809148ff79ce28cfeb666ef59b4a1d68795cc1 (diff) | |
| download | homebrew-5b6e0fb0cfef66e3762863cbf74219ed7c4321ec.tar.bz2 | |
doctor: suppress warnings from git wrapper script
Fixes #28901.
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 5945fa31b..bce3ddb4f 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -53,6 +53,14 @@ class Checks def inject_file_list(list, str) list.inject(str) { |s, f| s << " #{f}\n" } end + + # Git will always be on PATH because of the wrapper script in + # Library/Contributions/cmd, so we check if there is a *real* + # git here to avoid multiple warnings. + def git? + return @git if instance_variable_defined?(:@git) + @git = which("git") && quiet_system("git", "--version") + end ############# END HELPERS # Sorry for the lack of an indent here, the diff would have been unreadable. @@ -728,7 +736,7 @@ def __check_git_version end def check_for_git - if which "git" + if git? __check_git_version else <<-EOS.undent Git could not be found in your PATH. @@ -740,7 +748,7 @@ def check_for_git end def check_git_newline_settings - return unless which "git" + return unless git? autocrlf = `git config --get core.autocrlf`.chomp @@ -758,7 +766,7 @@ def check_git_newline_settings end def check_git_origin - return unless which('git') && (HOMEBREW_REPOSITORY/'.git').exist? + return unless git? && (HOMEBREW_REPOSITORY/'.git').exist? HOMEBREW_REPOSITORY.cd do origin = `git config --get remote.origin.url`.strip @@ -902,7 +910,7 @@ def check_missing_deps end def check_git_status - return unless which "git" + return unless git? HOMEBREW_REPOSITORY.cd do unless `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty? <<-EOS.undent_________________________________________________________72 @@ -1014,7 +1022,7 @@ def check_for_pydistutils_cfg_in_home end def check_for_outdated_homebrew - return unless which 'git' + return unless git? HOMEBREW_REPOSITORY.cd do if File.directory? ".git" local = `git rev-parse -q --verify refs/remotes/origin/master`.chomp |
