Skip to content

UPSTREAM PR #2497: feat!: add hash_kind to TreeRefIter and Data#40

Open
loci-dev wants to merge 16 commits intomainfrom
loci/pr-2497-pass-hash-len-to-tree-ref-iter
Open

UPSTREAM PR #2497: feat!: add hash_kind to TreeRefIter and Data#40
loci-dev wants to merge 16 commits intomainfrom
loci/pr-2497-pass-hash-len-to-tree-ref-iter

Conversation

@loci-dev
Copy link
Copy Markdown

@loci-dev loci-dev commented Apr 5, 2026

Note

Source pull request: GitoxideLabs/gitoxide#2497

This PR is an attempt at making the hash length in gix_object::tree::ref_iter::decode depend on the decoded tree’s hash’s size. Previously, it was hardcoded to 20 which is only correct for SHA1, but not for SHA256.

There were quite a few follow-up changes as TreeRef::from_bytes as well as TreeRefIter::from_bytes now take hash_kind as an argument. Also, since TreeRef can be instantiated in Data::decode, Data now also has to carry hash_kind. Another option that I didn’t explore would have been to add hash_kind as an argument to Data::decode.

Update 2026-04-04: I changed the initial addition of hash_len to hash_kind. Tests are now passing, with the exception of the fuzzer having found an issue.

@loci-dev loci-dev force-pushed the main branch 3 times, most recently from cdbe120 to 78a7ab5 Compare April 11, 2026 07:49
@loci-dev loci-dev force-pushed the main branch 6 times, most recently from 49231d8 to bc0a777 Compare April 20, 2026 07:18
@loci-dev loci-dev force-pushed the main branch 4 times, most recently from e902b63 to c6739bc Compare April 27, 2026 07:26
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