doctor: suppress warnings from git wrapper script
Fixes Homebrew/homebrew#28901.
This commit is contained in:
parent
37760ce3f8
commit
cf5ecfc06d
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user