New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix installing from API with tap names #12340
Fix installing from API with tap names #12340
Conversation
Review period skipped due to |
next if File.exist?(name) | ||
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX | ||
next unless name =~ HOMEBREW_TAP_FORMULA_REGEX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand this check (mainly why there's a separate check for HOMEBREW_TAP_FORMULA_REGEX
and HOMEBREW_CASK_TAP_CASK_REGEX
.
As far as I can tell, there is no situation where name
would not match HOMEBREW_TAP_FORMULA_REGEX
but would match HOMEBREW_CASK_TAP_CASK_REGEX
so I removed the second check. Let me know if there's a case I'm missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it does match HOMEBREW_TAP_FORMULA_REGEX
but does not match HOMEBREW_CASK_TAP_CASK_REGEX
? Is that possible? Or is this case not relevant? I hate conditionals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it matches HOMEBREW_TAP_FORMULA_REGEX
, then the first part of the conditional (name !~ HOMEBREW_TAP_FORMULA_REGEX
) is false
so the entire conditional is false
. So it doesn't matter if it matches HOMEBREW_CASK_TAP_CASK_REGEX
or not.
Yeah, I had to go over this like 50 times to understand what it meant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may have been for when these regexes were different. I'm fine with them being removed.
next if File.exist?(name) | ||
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX | ||
next unless name =~ HOMEBREW_TAP_FORMULA_REGEX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may have been for when these regexes were different. I'm fine with them being removed.
Thanks again @Rylan12! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Follow-up to #12333 (also there's a chance that this fixes #12326)
This PR fixes
brew install
withHOMEBREW_INSTALL_FROM_API
set so that it will work forbrew install homebrew/core/foo
andbrew install homebrew/cask/foo
.I marked this as
critical
because it fixes a bug that was introduced in #12333.