Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of min version merging in DependencyList #4987

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Nov 19, 2024

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

@JohnMcPMS JohnMcPMS requested a review from a team as a code owner November 19, 2024 01:22
@JohnMcPMS JohnMcPMS merged commit 03df824 into microsoft:master Nov 19, 2024
9 checks passed
@JohnMcPMS JohnMcPMS deleted the bad-opt branch November 19, 2024 19:25
JohnMcPMS added a commit to JohnMcPMS/winget-cli that referenced this pull request Nov 21, 2024
)

Likely fix for microsoft#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.
JohnMcPMS added a commit that referenced this pull request Nov 22, 2024
[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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants