Skip to content

Conversation

@Byron
Copy link
Member

@Byron Byron commented Dec 18, 2025

This can be useful in certain situations where the set of candidate object ids is very small.

Copy link

Copilot AI left a comment

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 adds a new method Prefix::from_hex_nonempty() that allows creating prefix instances from shorter hexadecimal strings (as short as 1 character), which can be useful when working with small sets of candidate object IDs. The existing from_hex() method has been refactored to delegate to the new method after checking the minimum length constraint.

Key Changes:

  • Refactored Prefix::from_hex() to enforce the 4-character minimum and delegate to the new method
  • Added Prefix::from_hex_nonempty() that accepts any non-empty hex string (1+ characters)
  • Added comprehensive test suite for the new functionality

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
gix-hash/src/prefix.rs Implements the new from_hex_nonempty() method and refactors from_hex() to use it
gix-hash/tests/hash/prefix.rs Adds test module covering various input lengths for the new method, including edge cases
Cargo.lock Dependency version updates (unrelated to the feature)

…xes.

This can be useful in certain situations where the set of candidate object ids
is very small.
@Byron Byron enabled auto-merge December 18, 2025 14:08
@Byron Byron merged commit d207075 into main Dec 18, 2025
28 checks passed
@Byron Byron deleted the improvements branch December 18, 2025 14:43
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