| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
WalkthroughRefactors short_git_version in crates/libzkp/src/utils.rs to consistently derive a 7-character commit abbreviation by splitting GIT_VERSION on hyphens, removing a leading 'g' if present, and truncating to seven characters. No public API signatures were changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)crates/libzkp/src/utils.rs (1)📜 Review details18-20: Edge case: exact tag builds can return the tag name, not a hash
At an exact tag, git describe --always returns the tag itself (e.g., v1.2.3), so split('-').next_back() yields the tag; the function would emit "v1.2.3" (truncated) instead of a 7-char hex. If callers expect a hex abbrev, release builds at tags will be inconsistent.
Two low-friction fixes (either is fine):
- Make git describe always include the -g<hash> suffix by adding --long.
- Or scan from the end for the first segment that looks like g[0-9a-f]+ or [0-9a-f]+ before truncating.
Apply this minimal change if you prefer the --long approach:
@@ -const GIT_VERSION: &str = git_version!(args = ["--abbrev=7", "--always"]); +const GIT_VERSION: &str = git_version!(args = ["--abbrev=7", "--always", "--long"]);Or, keep current args and harden the parsing:
@@ pub(crate) fn short_git_version() -> String { - let last = GIT_VERSION.split('-').next_back().unwrap(); - let hash = last.strip_prefix('g').unwrap_or(last); - hash.chars().take(7).collect() + let cand = GIT_VERSION + .rsplit('-') + .find(|s| s.starts_with('g') || s.chars().all(|c| c.is_ascii_hexdigit())) + .unwrap_or(GIT_VERSION); + let hash = cand.strip_prefix('g').unwrap_or(cand); + hash.chars().take(7).collect()Optional test suggestion (to guard both forms and exact-tag): extract the parsing into a small helper fn short_from(s: &str) -> String and unit-test inputs like v1.2.3-45-gabcdef1, abcdef1, and v1.2.3.
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 CommitsReviewing files that changed from the base of the PR and between a5a7844 and b8bd5fd.
📒 Files selected for processing (1)crates/libzkp/src/tasks/chunk.rs (1)🔇 Additional comments (1)
- hash (190-190)
crates/libzkp/src/utils.rs (1)18-20: LGTM: simpler and correct normalization of g-prefixed vs bare hashes
The new logic robustly strips an optional leading 'g' and safely truncates to 7 chars without indexing panics. Matches the PR goal.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor