Disallow duplicate assets when merging manifests#2763
Merged
mmitche merged 7 commits intodotnet:mainfrom Aug 2, 2023
Merged
Conversation
When merging manifests, we were distincting the assets and erroring if there are dupes. This should have been done using an equality comparer that compares based on Id alone. Fix this, and add appropriate testing. Resolves: dotnet#2762
dkurepa
reviewed
Jul 20, 2023
|
|
||
| // Error out for any duplicated packages based on the top level properties of the package. | ||
| var distinctPackages = manifest.Packages.Distinct(); | ||
| var distinctPackages = manifest.Packages.Distinct(new PackageIdComparer()); |
Member
There was a problem hiding this comment.
We could also use DistinctBy(package => package.Id, StringComparison.OrdinalIgnoreCase) if we don't need the Hash part later
Member
Author
There was a problem hiding this comment.
I knew there was a predicate version, but I couldn't remember what it was called. I'll change that.
Member
Author
|
@dkurepa I fixed the tests, including an additional issue. The merged manifest tests were only passing by coincidence. There were some tests that were adding packages/blobs to the manifest1/manifest3 objects in the class. NUnit does not re-initialize a new TestFixture class object per test, so if tests ran in a different, you could get different results. |
MilenaHristova
approved these changes
Aug 2, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When merging manifests, we were distincting the assets and erroring if there are dupes. This should have been done using an equality comparer that compares based on Id alone. Fix this, and add appropriate testing.
Resolves: #2762