Merge pull request #20098 from Homebrew/hide_main_branches

Hide `main` branches from `brew tap-info` and `brew info`
This commit is contained in:
Mike McQuaid 2025-06-13 16:11:23 +00:00 committed by GitHub
commit dfd0cc8d85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -63,6 +63,8 @@ module Homebrew
puts info puts info
else else
info = "" info = ""
default_branches = %w[main master].freeze
taps.each_with_index do |tap, i| taps.each_with_index do |tap, i|
puts unless i.zero? puts unless i.zero?
info = "#{tap}: " info = "#{tap}: "
@ -79,7 +81,7 @@ module Homebrew
info += "\norigin: #{tap.remote}" if tap.remote != tap.default_remote info += "\norigin: #{tap.remote}" if tap.remote != tap.default_remote
info += "\nHEAD: #{tap.git_head || "(none)"}" info += "\nHEAD: #{tap.git_head || "(none)"}"
info += "\nlast commit: #{tap.git_last_commit || "never"}" info += "\nlast commit: #{tap.git_last_commit || "never"}"
info += "\nbranch: #{tap.git_branch || "(none)"}" if tap.git_branch != "master" info += "\nbranch: #{tap.git_branch || "(none)"}" if default_branches.exclude?(tap.git_branch)
else else
info += "Not installed" info += "Not installed"
end end

View File

@ -128,7 +128,8 @@ module SystemConfig
out.puts "#{tap_name} origin: #{tap.remote}" if tap.remote != tap.default_remote out.puts "#{tap_name} origin: #{tap.remote}" if tap.remote != tap.default_remote
out.puts "#{tap_name} HEAD: #{tap.git_head || "(none)"}" out.puts "#{tap_name} HEAD: #{tap.git_head || "(none)"}"
out.puts "#{tap_name} last commit: #{tap.git_last_commit || "never"}" out.puts "#{tap_name} last commit: #{tap.git_last_commit || "never"}"
out.puts "#{tap_name} branch: #{tap.git_branch || "(none)"}" if tap.git_branch != "master" default_branches = %w[main master].freeze
out.puts "#{tap_name} branch: #{tap.git_branch || "(none)"}" if default_branches.exclude?(tap.git_branch)
end end
if (json_file = Homebrew::API::HOMEBREW_CACHE_API/json_file_name) && json_file.exist? if (json_file = Homebrew::API::HOMEBREW_CACHE_API/json_file_name) && json_file.exist?