Skip to content

Commit

Permalink
feat(tap-info): display Git information about non-Core/non-API taps
Browse files Browse the repository at this point in the history
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/<tap> show -s --decorate

Close Homebrew#18381
  • Loading branch information
benknoble committed Sep 30, 2024
1 parent 0ac568b commit 3429e74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Library/Homebrew/cmd/tap-info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def print_tap_info(taps)
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
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,9 @@ def to_hash
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
Expand Down

0 comments on commit 3429e74

Please sign in to comment.