Skip to content

Commit

Permalink
Improve diagnostic for Git fsmonitor settings in Homebrew repository:
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
mfilippov committed Jul 18, 2024
1 parent 1c98a33 commit e40a207
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Check warning on line 526 in Library/Homebrew/diagnostic.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/diagnostic.rb#L526

Added line #L526 was not covered by tests
return if fsmonitor != "true"

<<~EOS

Check warning on line 529 in Library/Homebrew/diagnostic.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/diagnostic.rb#L529

Added line #L529 was not covered by tests
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?
Expand Down

0 comments on commit e40a207

Please sign in to comment.