You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR Review: fix: short version sha should be length = 8
Gathering context
Reviewing changed files
Posting review feedback
Summary
Simple one-line fix in crates/version/build.rs: changes &sha[0..7] → &sha[0..8] to produce an 8-character short SHA.
What's Good
The fix correctly resolves an inconsistency in the file. Line 29 (VERGEN_GIT_SHA_SHORT) was already using &sha[..8] (8 chars), but sha_short on line 21 was only taking 7 chars — meaning the version string displayed a 7-char SHA while the env var exposed an 8-char one. This unifies them.
VERGEN_GIT_DESCRIBE comes from git describe --tags --long, which by default appends a 7-character short SHA (e.g. v0.1.0-3-gabcdef1). Now that sha_short is 8 chars, "-g{sha_short}" would be "-gabcdef12" (8 chars after g), which may not match the 7-char SHA in the describe output.
If this mismatch occurs, not_on_tag would always be false, meaning the -dev version suffix would only be added when the working tree is dirty — not when there are commits after a tag. Worth verifying that the -dev suffix still appears correctly on non-tagged commits.
Note:vergen_git2 may configure git describe to use the same short SHA length as VERGEN_GIT_SHA, in which case this would not be an issue. Checking the vergen_git2 docs or testing on a commit between tags would confirm.
Minor: Duplicate slice
Lines 21 and 29 both slice sha to 8 chars:
// line 21let sha_short = &sha[0..8];// ...// line 29println!("cargo:rustc-env=VERGEN_GIT_SHA_SHORT={}",&sha[..8]);
Line 29 could just use sha_short instead of re-slicing, e.g.:
Approve with minor note — the core fix is correct and eliminates the 7-vs-8 inconsistency. Recommend verifying the not_on_tag behavior on a non-tagged commit to confirm the -dev suffix still works as expected.
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
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.
before this pr look like:
6723ce3 is length of 7.
after this pr:
be14d8b is length of 8.