Reproducibility and pinning¶
The rendered output becomes a Git commit, so "what produced this tree?" must have an answer. This page is about how much of that answer git-tpl can give.
What is already pinned¶
The template. ref resolves to a commit SHA, recorded in the trailers as Template-Commit.
Rendering that revision again gives the same template files.
A template's parent, if it has one. [extends].rev accepts tags and commit IDs, rejecting branches.
Only a full commit ID is immutable: a tag is refreshed online and may move.
The resolved commit is recorded as Template-Extends, one per ancestor.
See ADR-034.
Template data. Read from the template's Git tree at that same commit, so it is pinned by the template revision. There is no second thing to pin, and no way for a template's files and its data to drift apart.
Git data pinned to a full commit ID. Read from another repository's tree at that immutable commit.
A ref naming a branch or tag can move and belongs in the next section.
The answers. Recorded in .config/git.tpl.toml, and digested into Answers-Digest so a change is detectable
without reading the file.
The engine. Tpl-Version records which git-tpl produced the tree, so a rendering difference caused by a
git-tpl change is attributable.
The retained one-shot baseline. Captured output bytes and modes come from the previous rendered tree,
and cumulative Template-Once records identify initialized paths even after their declarations disappear.
Preserve that rendered history: current template inputs and project configuration alone cannot reconstruct it.
Together, these inputs make rendering reproducible when all external inputs are also preserved or immutable.
What is not: mutable data and moving refs¶
A remote URL can serve different bytes tomorrow, and branches and tags can move. Project-local data can also change independently of the template, including through uncommitted or untracked files. Nothing about the template revision constrains those inputs.
Every contributing source is recorded, and for a remote source the digest of the bytes actually received is recorded with it — whether or not the template pinned one.
Data-Source: licenses = template:data/licenses.toml@8b3e7d1
Data-Source: registry = remote:https://example.com/registry.json@sha256:9f86d081…
Read it back from Git:
These trailers identify the contributing sources. HTTP digests identify changes in received bytes, and Git revisions identify the source trees. Project-local data records only its path, so its trailer cannot establish whether its bytes changed. Preserve those files separately, for example in project history, and optionally declare a checksum to verify them. See local data provenance. Guaranteeing they will not change is the next section.
Pinning¶
[data.licenses]
source = "https://example.com/licenses.toml"
sha256 = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
A mismatch is an error, never a warning: the point of a pin is that the render stops rather than producing a plausible tree from content the template did not vouch for. Both digests are reported, so "the source changed" is distinguishable from "the pin is wrong".
HTTP bodies matching a declared checksum are
cached across runs.
The raw bytes are verified on every acquisition, independently of URL and parsing format.
A populated pin works with --offline; a missing object must be populated online first.
Corruption is an error requiring explicit clearing and an online retry, never permission to trust cached bytes.
Unpinned URLs retain their network-dependent behavior, including versioned URLs without a declared checksum.
Exact, verifiable, and the strongest option — at the cost of a manual update whenever the source legitimately changes. It is accepted on any kind of data source, though a template file is already pinned by the template revision.
For HTTP sources, the digest is in the trailers of the last rendering, so recording a pin does not mean computing one by hand. Project-local trailers contain only paths; compute their checksums from the preserved input bytes.
Requires nothing from git-tpl, and is the right answer when you control the host. A version in the path is a pin.
[data.shared]
source = "https://github.com/acme/tpl-data"
ref = "4f2c1a9e6b3d8f05a1c7e2b94d6f8a03c5e17b29"
path = "licenses.toml"
Reuses the mechanism the template itself uses, so the pin is a commit SHA and the provenance format already describes it. A full commit ID is immutable; branches and tags refresh online and may move. The trailer records the resolved commit either way, making a difference explainable rather than preventing it. See Git data.
Determinism is the wider property¶
Pinning addresses external data. The rest of the determinism guarantee — traversal order, line endings, permissions, no timestamps, no environment, no runtime context — is covered in Determinism.
The two together are what make it safe for the rendered output to be a Git ref: an update that produces no
change makes no commit, so the ref only grows when something real changed.