From 3429e74d7e08913eb3cd4665ea02f93bac673e5d Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Mon, 30 Sep 2024 11:27:35 -0400 Subject: [PATCH] feat(tap-info): display Git information about non-Core/non-API taps Copy and tweak code from Library/Homebrew/system_config.rb:110 to commit and date information. This information can be useful when debugging formulae in custom taps to ensure the tap has been correctly updated recently or to suss out important differences from one version of a tap to another. This removes the need to ask users to run something like git -C $(brew --repository)/Library/Taps/ show -s --decorate Close https://github.com/Homebrew/brew/issues/18381 --- Library/Homebrew/cmd/tap-info.rb | 4 ++++ Library/Homebrew/tap.rb | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index 2d00a70cb8..bca5486604 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -76,6 +76,10 @@ module Homebrew info += "\nPrivate" if tap.private? info += "\n#{tap.path} (#{tap.path.abv})" info += "\nFrom: #{tap.remote.presence || "N/A"}" + info += "\norigin: #{tap.remote}" if tap.remote != tap.default_remote + info += "\nHEAD: #{tap.git_head || "(none)"}" + info += "\nlast commit: #{tap.git_last_commit || "never"}" + info += "\nbranch: #{tap.git_branch || "(none)"}" if tap.git_branch != "master" else info += "Not installed" end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index dd78d0a97c..4bf6350582 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -881,6 +881,9 @@ class Tap hash["remote"] = remote hash["custom_remote"] = custom_remote? hash["private"] = private? + hash["HEAD"] = git_head || "(none)" + hash["last_commit"] = git_last_commit || "never" + hash["branch"] = git_branch || "(none)" end hash