Merge pull request #6582 from EricFromCanada/doctor-modified-files

doctor: list any uncommitted modified files in CI
This commit is contained in:
Mike McQuaid 2019-10-18 09:49:42 +01:00 committed by GitHub
commit d3d8869468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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