Only treat symlinks in taps as alias paths.
Fixes https://github.com/Homebrew/homebrew-core/issues/162946.
This commit is contained in:
parent
e0743a1436
commit
964f005b3e
@ -599,10 +599,26 @@ module Formulary
|
|||||||
|
|
||||||
return unless path.expand_path.exist?
|
return unless path.expand_path.exist?
|
||||||
|
|
||||||
options = if path.symlink?
|
options = if (tap = Tap.from_path(path))
|
||||||
|
# Only treat symlinks in taps as aliases.
|
||||||
|
if path.symlink?
|
||||||
alias_path = path
|
alias_path = path
|
||||||
path = alias_path.resolved_path
|
path = alias_path.resolved_path
|
||||||
{ alias_path: alias_path }
|
|
||||||
|
{
|
||||||
|
alias_path: alias_path,
|
||||||
|
tap: tap,
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tap: tap,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
elsif (tap = Homebrew::API.tap_from_source_download(path))
|
||||||
|
# Don't treat cache symlinks as aliases.
|
||||||
|
{
|
||||||
|
tap: tap,
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
@ -612,15 +628,13 @@ module Formulary
|
|||||||
new(path, **options)
|
new(path, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(path: T.any(Pathname, String), alias_path: Pathname).void }
|
sig { params(path: T.any(Pathname, String), alias_path: Pathname, tap: Tap).void }
|
||||||
def initialize(path, alias_path: T.unsafe(nil))
|
def initialize(path, alias_path: T.unsafe(nil), tap: T.unsafe(nil))
|
||||||
path = Pathname(path).expand_path
|
path = Pathname(path).expand_path
|
||||||
name = path.basename(".rb").to_s
|
name = path.basename(".rb").to_s
|
||||||
alias_path = alias_path&.expand_path
|
alias_path = alias_path&.expand_path
|
||||||
alias_dir = alias_path&.dirname
|
alias_dir = alias_path&.dirname
|
||||||
|
|
||||||
tap = Tap.from_path(path) || Homebrew::API.tap_from_source_download(path)
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
alias_path: (alias_path if alias_dir == tap&.alias_dir),
|
alias_path: (alias_path if alias_dir == tap&.alias_dir),
|
||||||
tap: tap,
|
tap: tap,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user