feat(cli): include git hash in fe --version output#1363
feat(cli): include git hash in fe --version output#13630xWeakSheep wants to merge 7 commits intoargotorg:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06f2d18b75
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| use std::process::Command; | ||
|
|
||
| fn main() { | ||
| println!("cargo:rerun-if-changed=.git/HEAD"); |
There was a problem hiding this comment.
Recompute git hash when HEAD commit changes
cargo:rerun-if-changed=.git/HEAD does not reliably invalidate this build script for new commits, so FE_GIT_HASH can go stale and fe --version can report an old hash. In this crate (crates/fe), .git/HEAD is not the repo’s HEAD file, and even if the path were corrected, HEAD’s contents usually stay unchanged while advancing commits on the same branch; as a result, rebuilding after a new commit (without touching source files) may keep the previous hash.
Useful? React with 👍 / 👎.
Summary
This PR resolves #1338 by adding the current git short hash to
fe --version.Before:
fe 26.0.0-alpha.7After:
fe 26.0.0-alpha.7 (6d15b3851)(example)What changed
crates/fe/build.rs:git rev-parse --short HEADat build time.FE_GIT_HASHviacargo:rustc-env.FE_GIT_HASHenvironment variable.crates/fe/src/main.rs:cli_version()to format version output.#[command(version)]to#[command(version = cli_version())].Validation
cargo run -q -p fe -- --version