From ef19c9fc889def4e62bb932180eae35c1413f022 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 3 Apr 2024 19:44:12 +0100 Subject: [PATCH] brew.rb: improve no auto-update exception handling. Instead of unconditionally telling people to `brew update` rather than not reporting the issue, only do so if they haven't run `brew update` today. --- Library/Homebrew/brew.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 4e43428938..06e3bccecc 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -186,8 +186,10 @@ rescue Exception => e # rubocop:disable Lint/RescueException if OS.unsupported_configuration? $stderr.puts "#{Tty.bold}Do not report this issue: you are running in an unsupported configuration.#{Tty.reset}" - elsif Homebrew::EnvConfig.no_auto_update? - $stderr.puts "#{Tty.bold}You have disabled automatic updates.#{Tty.reset}" + elsif Homebrew::EnvConfig.no_auto_update? && + (fetch_head = HOMEBREW_REPOSITORY/".git/FETCH_HEAD") && + (!fetch_head.exist? || (fetch_head.mtime.to_date < Date.today)) + $stderr.puts "#{Tty.bold}You have disabled automatic updates and have not updated today.#{Tty.reset}" $stderr.puts "#{Tty.bold}Do not report this issue until you've run `brew update` and tried again.#{Tty.reset}" elsif (issues_url = (method_deprecated_error && e.issues_url) || Utils::Backtrace.tap_error_url(e)) $stderr.puts "If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):"