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