cmd/update-report: correctly handle added/deleted formulae/casks.

If a formulae or cask is marked as both added and deleted, we've just
incorrectly detected it. Remove it from the report.

This can happen when a formula or cask is moved around in the repository
e.g. with sharding.
This commit is contained in:
Mike McQuaid 2023-08-14 19:28:56 +01:00
parent 0bd17c5b79
commit 38f00671c4
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829

View File

@ -566,6 +566,17 @@ class Reporter
@report[:R] = renamed_formulae.to_a
end
# If any formulae/casks are marked as added and deleted, remove them from
# the report as we've not detected things correctly.
if (added_and_deleted_formulae = (@report[:A] & @report[:D]).presence)
@report[:A] -= added_and_deleted_formulae
@report[:D] -= added_and_deleted_formulae
end
if (added_and_deleted_casks = (@report[:AC] & @report[:DC]).presence)
@report[:AC] -= added_and_deleted_casks
@report[:DC] -= added_and_deleted_casks
end
@report
end