doctor: list any uncommitted modified files

This commit is contained in:
EricFromCanada 2019-10-11 11:47:33 -04:00
parent 2bf8015bc4
commit 6bc1785c88

View File

@ -663,17 +663,28 @@ module Homebrew
def check_git_status def check_git_status
return unless Utils.git_available? return unless Utils.git_available?
modified = []
HOMEBREW_REPOSITORY.cd do HOMEBREW_REPOSITORY.cd do
return if `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty? modified.concat `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.split("\n")
return if modified.empty?
end end
<<~EOS message = <<~EOS
You have uncommitted modifications to Homebrew. You have uncommitted modifications to Homebrew.
If this is a surprise to you, then you should stash these modifications. If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason. should you later need to do so for some reason.
cd #{HOMEBREW_LIBRARY} && git stash && git clean -d -f cd #{HOMEBREW_LIBRARY} && git stash && git clean -d -f
EOS EOS
if ENV["CI"]
message += inject_file_list modified, <<~EOS
Modified files:
EOS
end
message
end end
def check_for_bad_python_symlink def check_for_bad_python_symlink