cmd/update-report: do not fail when tap has no origin

This fixes the following error:

    $ brew update
    Warning: No remote 'origin' in /usr/local/Homebrew/Library/Taps/foo/homebrew-bar, skipping update!
    Error: HOMEBREW_UPDATE_BEFORE_FOO_HOMEBREW_BAR is unset!
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:361:in `initialize'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:187:in `new'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:187:in `block in output_update_report'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:748:in `block (2 levels) in each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:747:in `each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:747:in `block in each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:746:in `each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:746:in `each'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:160:in `output_update_report'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:40:in `update_report'
    /usr/local/Homebrew/Library/Homebrew/brew.rb:94:in `<main>'
    Already up-to-date.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
This commit is contained in:
Ruoyu Zhong 2023-04-30 06:43:22 +08:00
parent 01e0c20d01
commit 5d9c3d0432
No known key found for this signature in database
GPG Key ID: DCAF462CAB59907D

View File

@ -158,7 +158,7 @@ module Homebrew
updated_taps = []
Tap.each do |tap|
next unless tap.git?
next if !tap.git? || tap.git_repo.origin_url.nil?
next if (tap.core_tap? || tap == "homebrew/cask") && !Homebrew::EnvConfig.no_install_from_api?
if ENV["HOMEBREW_MIGRATE_LINUXBREW_FORMULAE"].present? && tap.core_tap? &&