Merge pull request #14618 from Bo98/maximum-req-name-fix

formula: fix `to_hash` tampering with requirement names
This commit is contained in:
Mike McQuaid 2023-02-14 11:14:51 +00:00 committed by GitHub
commit 8aa495b19b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2156,9 +2156,10 @@ class Formula
end end
hsh["requirements"] = requirements.map do |req| hsh["requirements"] = requirements.map do |req|
req.name.prepend("maximum_") if req.try(:comparator) == "<=" req_name = req.name.dup
req_name.prepend("maximum_") if req.try(:comparator) == "<="
{ {
"name" => req.name, "name" => req_name,
"cask" => req.cask, "cask" => req.cask,
"download" => req.download, "download" => req.download,
"version" => req.try(:version) || req.try(:arch), "version" => req.try(:version) || req.try(:arch),