diagnostic: check homebrew-core git status.
Also look in Homebrew/homebrew-core for uncommitted files (in some ways we care about uncommitted stuff there more than Homebrew/brew). Also, list all the modified files even when on non-CI to make it easier for users to figure out their own issues and check the contents of the whole repos rather than just a subdirectory. In general this is a cleanup that should have been done long ago (when we split Homebrew/brew and Homebrew/homebrew-core).
This commit is contained in:
parent
ee69c5aec3
commit
4e5b9f57ca
@ -643,26 +643,31 @@ module Homebrew
|
|||||||
def check_git_status
|
def check_git_status
|
||||||
return unless Utils.git_available?
|
return unless Utils.git_available?
|
||||||
|
|
||||||
modified = []
|
message = nil
|
||||||
HOMEBREW_REPOSITORY.cd do
|
|
||||||
status = `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`
|
|
||||||
return if status.blank?
|
|
||||||
|
|
||||||
modified = status.split("\n")
|
{
|
||||||
|
"Homebrew/brew" => HOMEBREW_REPOSITORY,
|
||||||
|
"Homebrew/homebrew-core" => CoreTap.instance.path,
|
||||||
|
}.each do |name, path|
|
||||||
|
status = path.cd do
|
||||||
|
`git status --untracked-files=all --porcelain 2>/dev/null`
|
||||||
end
|
end
|
||||||
|
next if status.blank?
|
||||||
|
|
||||||
message = <<~EOS
|
message ||= ""
|
||||||
You have uncommitted modifications to Homebrew.
|
message += "\n" unless message.empty?
|
||||||
|
message += <<~EOS
|
||||||
|
You have uncommitted modifications to #{name}.
|
||||||
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 #{path} && git stash && git clean -d -f
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
if ENV["CI"]
|
modified = status.split("\n")
|
||||||
message += inject_file_list modified, <<~EOS
|
message += inject_file_list modified, <<~EOS
|
||||||
|
|
||||||
Modified files:
|
Uncommitted files:
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user