Write git-commit-{sha,info} for Cargo in source tarballs by pietroalbini · Pull Request #124553 · rust-lang/rust (original) (raw)

Right now Cargo doesn't populate the commit hash or date in its version output when it's built from the plain source tarball. That's because we don't include the git information for it, and Cargo's build script doesn't pick it up.

This PR partially solves the problem by storing the git information for Cargo in src/tools/cargo in the plain source tarball. We store separate information because even when built in CI Cargo uses its own git information rather than Rust's.

This PR will also require a change in the Cargo repository to consume this information (rust-lang/cargo#13832), but it doesn't have to be blocked on the Cargo PR being merged.