formula: dedupe link_overwrite_formulae across aliases#22046
Merged
MikeMcQuaid merged 1 commit intomainfrom Apr 20, 2026
Merged
formula: dedupe link_overwrite_formulae across aliases#22046MikeMcQuaid merged 1 commit intomainfrom
MikeMcQuaid merged 1 commit intomainfrom
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes duplicated entries in Formula#link_overwrite_reason warnings when link_overwrite_formulae_names contains both an alias and a canonical name that resolve to the same formula, by deduplicating after resolution.
Changes:
- Deduplicate
link_overwrite_formulaeresults byfull_nameafter resolving names toFormulainstances. - Add a unit test asserting alias/canonical-name resolution does not produce duplicate formulae in
link_overwrite_formulae.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
Library/Homebrew/formula.rb |
Dedupes resolved overwrite formulae via uniq(&:full_name) to prevent duplicate warnings. |
Library/Homebrew/test/formula_spec.rb |
Adds a regression test for deduplication when alias and canonical names map to the same formula. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew lgtm(style, typechecking and tests) with your changes locally?Claude Code Opus 4.7 was used to create the test.
When I installed
openssl@4today, I was presented with this warning:After this change:
Formula#link_overwrite_formulae_namescan include both an alias (openssl) and its canonical name (openssl@3) as distinct strings that resolve to the sameFormulaviaFormula[], so the sentence ends up listing it twice. Dedupe byfull_nameafter resolving names to formulae.