Merge pull request #16688 from reitermarkus/alias-table

Fix `Tap#alias_table` when using the API.
This commit is contained in:
Markus Reiter 2024-02-17 04:41:20 +01:00 committed by GitHub
commit be8f1747bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -680,11 +680,12 @@ class Tap
# @private
sig { returns(T::Array[String]) }
def aliases
@aliases ||= alias_files.map { |f| alias_file_to_name(f) }
@aliases ||= alias_table.keys
end
# a table mapping alias to formula name
# @private
sig { returns(T::Hash[String, String]) }
def alias_table
return @alias_table if @alias_table
@ -1133,11 +1134,13 @@ class CoreTap < AbstractCoreTap
end
# @private
sig { returns(T::Array[String]) }
def aliases
return super if Homebrew::EnvConfig.no_install_from_api?
Homebrew::API::Formula.all_aliases.keys
sig { returns(T::Hash[String, String]) }
def alias_table
@alias_table ||= if Homebrew::EnvConfig.no_install_from_api?
super
else
Homebrew::API::Formula.all_aliases
end
end
# @private