Repository navigation
fix(lockfile): normalize git commit object IDs to lowercase - #112
Merged
Merged
Conversation
isaim0011
force-pushed
the
fix/normalize-git-commit-ids
branch
from
September 21, 2026 07:02
8e5f048 to
f24f2d4
Compare
LunaStev
self-requested a review
September 21, 2026 07:58
LunaStev
approved these changes
Sep 21, 2026
LunaStev
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for the contribution!
The normalization is applied at the right boundary during lockfile parsing, while preserving the original lockfile contents for locked/offline operations. The SHA-1/SHA-256 parser coverage and the local Git regression test also cover the issue well.
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.
Closes #111
Summary
Git commit object IDs parsed from
vex.lockcan contain uppercase or mixed-case hexadecimal characters. Whilevalidate_commitaccepts valid 40-char (SHA-1) or 64-char (SHA-256) hex strings regardless of case, downstream identity checks (such asrequire_checkout_atandcheckout_commit) compare against canonical lowercase hashes output bygit rev-parse HEAD.This PR normalizes
commitstrings to lowercase during lockfile parsing (commit.to_ascii_lowercase()), ensuring:git rev-parse HEADlowercase comparisons.--locked,--offline).Testing
src/lockfile.rs:normalizes_sha1_and_sha256_git_commits_to_lowercase(tests lowercase, uppercase, and mixed-case for both 40-char SHA-1 and 64-char SHA-256).rejects_abbreviated_invalid_and_unsupported_length_commits(tests non-hex chars, spaces, and invalid lengths: 16, 39, 41, 63, 65 chars).tests/git_lock_reproducibility.rs:git_lock_accepts_uppercase_and_mixed_case_commit_ids_without_recheckout(verifies uppercase and mixed-case commit IDs succeed under--lockedand--offlinewithout re-checkout or rewritingvex.lock, and invalid commits are rejected).cargo test --locked).