Info: hide older kegs#22897
Conversation
Only show the newest keg of each formula plus any linked keg in the "Installed Kegs and Versions" section by default. Older, non-linked kegs are listed only with --verbose.
When a formula's possible names include both a rack and a symlink to that same rack (e.g. Cellar/python3 -> Cellar/python via the python3 alias), every keg under it was discovered once per name, so brew info listed each installed version twice. Dedupe the Cellar directories by their resolved physical path before collecting subdirs.
e83afab to
2ce7495
Compare
| def self.formula_installed_prefixes(formula_names) | ||
| Array(formula_names).map { |formula_name| HOMEBREW_CELLAR/Utils.name_from_full_name(formula_name) } | ||
| .select(&:directory?) | ||
| .uniq(&:realpath) |
There was a problem hiding this comment.
Prevent a problem where kegs were showing up twice because of symlinking.
carlocab
left a comment
There was a problem hiding this comment.
I'm not convinced this is the right fix. In general, I think it is useful if brew info $formula shows all the installed versions kegs (the header does say ==> Installed Kegs and Versions after all).
The output you're seeing does seem pathological, but this seems to be atypical for brew info (usually it just shows older installed versions).
|
@carlocab I'm temporarily on an old machine that is stuck at macOS 12 and cannot be upgraded anymore, so Homebrew is does not officially support it. I hope that is not causing this.
With that said, we recently changed how older versions are displayed, maybe that's why the output is expected for you?
The main problem with the old unliked version is that because |
|
We can also change the header to be |
I temporarily switched to my old laptop with outdated packages, and was confused about the output now, so thought I would improve it.
Only show the newest keg of each formula plus any linked keg in the "Installed Kegs and Versions" section by default. Older, non-linked kegs are listed only with --verbose.
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code wrote the code as it iterated toward the solution.
Manually tested changes.