From 6bc1785c88e49e43b5ac2cd809349d53745d4a83 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Fri, 11 Oct 2019 11:47:33 -0400 Subject: [PATCH 1/2] doctor: list any uncommitted modified files --- Library/Homebrew/diagnostic.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 3772b29e60..d05f07807d 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -663,17 +663,28 @@ 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? + modified.concat `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.split("\n") + return if modified.empty? 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 From 1e3ddcade1a05303ee62f69ce99024f2401e04ee Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 18 Oct 2019 09:22:34 +0100 Subject: [PATCH 2/2] diagnostic: tweak modified detection. --- Library/Homebrew/diagnostic.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index d05f07807d..77247e746c 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -665,8 +665,10 @@ module Homebrew modified = [] HOMEBREW_REPOSITORY.cd do - modified.concat `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.split("\n") - return if modified.empty? + status = `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null` + return if status.blank? + + modified = status.split("\n") end message = <<~EOS