Version + git-hash stamp
Per the nordisk version LAW, the skade-katalog serve binary reports both its semantic version and the exact commit it was built from.
Surface
$ skade-katalog --version # also: -V
skade v0.1.16 (2e677cb3b3b1)
The line is skade v<version> (<git-hash>) where:
<version>isskade_katalog::VERSION— the canonical skade product version (CARGO_PKG_VERSIONof the coreskade-katalogcrate,src/lib.rs), not the thin serve wrapper's own version. Co-located library callers can read the samepub const VERSIONto surface a consistent version anywhere.<git-hash>is the short (12-char) commit id, stamped at build time byserve/build.rsintoSKADE_GIT_HASH.
How the hash is derived (zero-shell)
serve/build.rs reads the commit id straight out of .git/ — it never shells out to git, honoring the zero-shelling law. It:
- walks up from
CARGO_MANIFEST_DIRto find.git(a directory, or agitdir:pointer file for a linked worktree/submodule, resolved viacommondir); - reads
.git/HEAD— a symbolicref: refs/heads/<b>is resolved via the loose ref file, falling back topacked-refs; a detached HEAD uses its raw id; - emits
cargo:rustc-env=SKADE_GIT_HASH=<short-sha>plusrerun-if-changedon every file it reads, so the stamp refreshes on each new commit.
When no repository is present (e.g. a cargo publish tarball build) it falls back to unknown rather than failing the build. The core crate's published tarball stays pristine: the build.rs and the stamp live only in the detached serve/ workspace; the core crate exposes just the plain VERSION const.