Skip to content

FileCatalog: Use IncrementalHash for consistency and simplify CompareBytes - #17137

Merged
akoeplinger merged 2 commits into
mainfrom
dev/akoeplinger/filecatalog-hash-cleanup
Jul 17, 2026
Merged

akoeplinger merged 2 commits into
mainfrom
dev/akoeplinger/filecatalog-hash-cleanup

Conversation

@akoeplinger

Copy link
Copy Markdown
Member

Some improvement found after looking at the code some more in #17133

akoeplinger and others added 2 commits July 17, 2026 10:48
Switch the list-identifier derivation from the legacy HashAlgorithm
TransformBlock streaming API to IncrementalHash, matching the rest of the
FileCatalog code (CatalogEntry.FromFile). Output is byte-for-byte identical
(same SHA-256 over the same concatenation), as verified by the catalog
fixture tests.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d4e0f156-2249-4165-96fb-c348b532a48b
Replace the manual byte-by-byte comparison loop with the built-in
allocation-free ReadOnlySpan<byte>.SequenceCompareTo, which yields the same
lexicographic ordering used for sorting and dedup.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d4e0f156-2249-4165-96fb-c348b532a48b
Copilot AI review requested due to automatic review settings July 17, 2026 09:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the managed FileCatalog CatalogBuilder implementation to make hashing behavior consistent and to simplify byte-array comparisons used for member sorting/deduplication, improving readability while keeping behavior stable.

Changes:

  • Switch list-identifier derivation from SHA256.TransformBlock/TransformFinalBlock to IncrementalHash for a cleaner incremental hashing flow.
  • Replace the manual byte-by-byte comparison helper with SequenceCompareTo on spans.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akoeplinger
akoeplinger enabled auto-merge (squash) July 17, 2026 09:24
@akoeplinger
akoeplinger requested a review from ViktorHofer July 17, 2026 13:11
@akoeplinger
akoeplinger merged commit 8ea0bbd into main Jul 17, 2026
11 checks passed
@akoeplinger
akoeplinger deleted the dev/akoeplinger/filecatalog-hash-cleanup branch July 17, 2026 14:20
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 18, 2026
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.

3 participants