Recover provenance from a tarball produced by git archive.
git get-tar-commit-id reads a tar archive on stdin and prints the commit SHA that produced it. Useful for verifying provenance of release tarballs made with git archive.
git archive embeds the source commit ID in a pax extended header inside the tar. This command just digs that field out, no repo needed.
git get-tar-commit-id < <tarball.tar>
git archive --format=tar HEAD | git get-tar-commit-id| Flag | What it does |
|---|---|
(none) | Reads tar from stdin; writes 40-char SHA + newline to stdout |
(no flags) | This command takes no flags or arguments |
exit 1 | Returned if the tar has no embedded commit ID |
works offline | No repository required to run |
git get-tar-commit-id < release-1.2.targit archive --format=tar HEAD | git get-tar-commit-idgit get-tar-commit-id < dist.tar | grep -q $(git rev-parse v1.2^{})gunzip -c release.tar.gz | git get-tar-commit-idHit each option, then Check answers. Score is recorded; Next is always open.