From e40a2078f10d9562a6b618ed9992eb949eb6ba8b Mon Sep 17 00:00:00 2001 From: Mikhail Filippov Date: Thu, 18 Jul 2024 12:22:12 +0400 Subject: [PATCH] Improve diagnostic for Git fsmonitor settings in Homebrew repository: - Added a check for the core.fsmonitor setting in the Homebrew repository - Provided an error message with instructions to disable fsmonitor if it is set to 'true' - Ensured the instructions specify making the change in the Homebrew repository folder This update helps prevent potential issues with lock files during 'brew upgrade' operations. --- Library/Homebrew/diagnostic.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 73d11882fc907..794dde2b9f5ff 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -520,6 +520,26 @@ def check_brew_git_origin examine_git_origin(repo, Homebrew::EnvConfig.brew_git_remote) end + def check_git_fsmonitor_settings + return unless Utils::Git.available? + + fsmonitor = HOMEBREW_REPOSITORY.cd { `git config --get core.fsmonitor`.chomp } + return if fsmonitor != "true" + + <<~EOS + Suspicious Git fsmonitor settings found. + + The detected Git fsmonitor settings could interfere with Homebrew operations: + core.fsmonitor = #{fsmonitor} + + This setting might block the lock file during a `brew upgrade` operation, + leading to potential issues and interruptions. + + If you encounter problems, consider disabling fsmonitor in the Homebrew repository by running: + cd #{HOMEBREW_REPOSITORY} && git config core.fsmonitor false + EOS + end + def check_coretap_integrity core_tap = CoreTap.instance unless core_tap.installed?