From 78227dc9247740e775427f2fd6372d14d71e9896 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Sun, 31 Aug 2025 22:34:30 +0800 Subject: [PATCH] tap: actively check repo visibility We shouldn't assume that the visibility of a tap keeps unchanged by storing it into `TapConfig`. Instead, let's actively check that to avoid e.g. collecting unwanted analytics. Also, speed up the check for known official public taps so that we don't waste our GitHub API token limit in CI. --- Library/Homebrew/tap.rb | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 5d2fcfbf44..ffab263397 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -366,23 +366,16 @@ class Tap return @private unless @private.nil? @private = T.let( - if (value = config[:private]).nil? - config[:private] = begin - if custom_remote? - true - else - # Don't store config if we don't know for sure. - return false if (value = GitHub.private_repo?(full_name)).nil? - - value - end - rescue GitHub::API::HTTPNotFoundError - true - rescue GitHub::API::Error + begin + if core_tap? || core_cask_tap? || OFFICIAL_CMD_TAPS.include?(name) false + elsif custom_remote? || (value = GitHub.private_repo?(full_name)).nil? + true + else + value end - else - value + rescue GitHub::API::Error + true end, T.nilable(T::Boolean), )