From d856d88c17051ddb64a9a1b93dde255e990952c2 Mon Sep 17 00:00:00 2001 From: Ryan Rotter Date: Fri, 29 Mar 2024 21:52:42 -0400 Subject: [PATCH] tap-info cmd: skip untapped core taps When homebrew/core or homebrew/cask are untapped `brew tap-info` fails because Tap.each includes them and tap.private? fails without a git repo interrogate. This restores the behavior of `brew tap-info` before #16710 --- Library/Homebrew/cmd/tap-info.rb | 2 +- Library/Homebrew/test/cmd/tap-info_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index ce1e5255d4..5428cca33c 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -48,7 +48,7 @@ module Homebrew formula_count = 0 command_count = 0 private_count = 0 - Tap.each do |tap| + Tap.installed.each do |tap| tap_count += 1 formula_count += tap.formula_files.size command_count += tap.command_files.size diff --git a/Library/Homebrew/test/cmd/tap-info_spec.rb b/Library/Homebrew/test/cmd/tap-info_spec.rb index b67f31cb00..394b79ebd8 100644 --- a/Library/Homebrew/test/cmd/tap-info_spec.rb +++ b/Library/Homebrew/test/cmd/tap-info_spec.rb @@ -13,4 +13,11 @@ RSpec.describe "brew tap-info" do .and not_to_output.to_stderr .and be_a_success end + + it "display brief statistics for all installed taps", :integration_test, :needs_network do + expect { brew "tap-info", "HOMEBREW_NO_INSTALL_FROM_API" => nil } + .to output(/\d+ taps?, \d+ private/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end end