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.37k stars 1.45k forks source link

Better handling of min version merging in DependencyList #4987

Closed JohnMcPMS closed 1 week ago

JohnMcPMS commented 1 week ago

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