microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.35k stars 1.45k forks source link

Better handling of min version merging in DependencyList #4997

Closed JohnMcPMS closed 3 days ago

JohnMcPMS commented 3 days ago

[Cherry pick #4987 to 1.9]

Likely fix for #4972

Change

Use std::optional overloaded operator to handle all of the comparisons in DependencyList::Add. The operator already properly handles all of the cases, including treating std::nullopt as always less than a defined value.

Also optimize a few other places around a reference to MinVersion.

Validation

Added a unit test covering the cases where Add needs to merge the minimum version value.

Microsoft Reviewers: Open in CodeFlow