Add Git information to cargo-gpu's --version CLI subcommand#623
Add Git information to cargo-gpu's --version CLI subcommand#623Steveplays28 wants to merge 1 commit into
--version CLI subcommand#623Conversation
nazar-pc
left a comment
There was a problem hiding this comment.
It is just my opinion, but it seems really wasteful to add such a massive dependency tree for such a tiny feature.
You essentially added more than 1000 lines of dependencies just to obtain VERGEN_GIT_COMMIT_DATE environment variable, which doesn't make sense to me. Everything else was already there.
Adding commit hash is a single line change instead of current +1346 -80, adding date is a bit more than that, but still less than what this PR does.
|
@nazar-pc well okay, fair. |
85f9e81 to
9ffe19b
Compare
|
I added a helper function for invoking Git, added My bad for not doing it in this simple way in the first place, I agree that this is better. Less time needed to compile and less code to maintain |
nazar-pc
left a comment
There was a problem hiding this comment.
This looks much better, thanks 🙂
9ffe19b to
959c711
Compare
Firestar99
left a comment
There was a problem hiding this comment.
I'm not yet sure if this is a net positive, would love input from others.
Some unordered thoughts:
- I didn't notice
cargo gpuon main already stored the commit rev, seecargo gpu show commitsh. Not very discoverable, definitely prefer putting it into the version. - a cargo package installed from crates.io won't have a git repo, so the git rev will be "unknown"
cargo nextest --versionalso prints the git rev, but also suffers from the same issue when installed viacargo install- there doesn't seem to be a nice universal way to handle this
- setting a
GIT_HASHenv var will force a larger recompile on each rev change cargo-denyci is broken, see #624
Added the commit hash and date to the `--version` CLI subcommand.
959c711 to
ae41cbe
Compare
|
My assumption is that this is primarily useful for identifying what version is used when reporting bugs. Versions published on crates.io are well known, while those installed from git may have the same version, but correspond to any revision. So it is fine to have |
Old:
New:
$ cargo-gpu --version cargo-gpu 0.10.0-alpha.1 (2e5047eb4b; 2026-06-28)I left the short version subcommand (
-V) unchanged.