Dependency pinning
A symbolic git ref, such as ref = "v0.4", can resolve to a different commit
after a tag moves. trellis pin replaces it with a commit SHA and records
the original ref in a comment on the same line. You can reproduce the pinned
dependency and use --update to follow the recorded ref.
trellis pin [pkgs...] # resolve symbolic refs to SHAs, record the intenttrellis pin --update [pkgs...] # re-resolve each recorded intent to its latest SHAtrellis pin --check [pkgs...] # fail if a pinned SHA drifted from its tracked reftrellis pin --unpin [pkgs...] # restore the symbolic refsThis is the consumer half of series tags: a
release force-moves lat_cli-v0.4 so consumers can track the series, and
pin is how a consumer follows that tag deliberately instead of silently.
It also works with branches and tags from other tools.
Pinning
Section titled “Pinning”pin scans [dependencies] and [dev-dependencies] of the selected
packages, all of them when none are named, for git requirements whose ref is
not already a full commit SHA. Each ref is resolved with
git ls-remote <url> <ref>, so there is no clone, any host works, and
authentication uses git’s configured credentials. An annotated tag
pins the commit it points at, not the tag object. Then ref is rewritten and
the original recorded in a # trellis:pin comment on the dependency’s own
line:
[dependencies]vestibule = { git = "https://github.com/example/monorepo.git", ref = "v0.4", path = "packages/vestibule" }vestibule = { git = "https://github.com/example/monorepo.git", ref = "93deb4c38d4b3f5848681ff7e9d59883db751c67", path = "packages/vestibule" } # trellis:pin v0.4$ trellis pin[lat_cli] pinned vestibule 93deb4c tracking v0.4Trellis preserves the rest of the file and updates the locked commit in
manifest.toml without gleam update or Hex traffic. If the package has no
lockfile, Gleam locks the pinned commit on its next dependency download.
Keep the # trellis:pin comment when copying a dependency to another manifest.
Deleting it stops --update from following that dependency; the SHA stays
pinned. Trellis also leaves hand-written SHAs without a pin comment unchanged.
Following the ref
Section titled “Following the ref”--update re-resolves every recorded ref and rewrites the SHAs that moved:
$ trellis pin --update[lat_cli] updated vestibule 51cbad6 was 93deb4c, tracking v0.4The result is a plain gleam.toml diff to review, so following a moving tag
becomes a deliberate, visible bump instead of a silent re-resolution. A
dependency already at its ref’s tip is untouched.
--unpin restores every recorded ref and removes the comments, returning the
manifest to its pre-pin text:
$ trellis pin --unpin[lat_cli] unpinned vestibule restored v0.4Catching a force-moved ref
Section titled “Catching a force-moved ref”--check verifies that each pinned SHA is an ancestor of (or equal to) the
commit its tracked ref points at now. A SHA no longer reachable from its ref
indicates rewritten history:
$ trellis pin --checkdrift: [lat_cli] `vestibule` is pinned at 51cbad6 which is not reachable from its tracked ref `v0.4` (now 8b9acd6) — the ref may have been force-movedIt exits 1 on any drift, so it drops straight into a PR gate:
# on: pull_request- run: trellis pin --checkdoctor runs the same check, but as an advisory warning: it needs the
network, and re-pinning past a force-move is a supply-chain decision
doctor --fix must not make. A network failure degrades to a warning too,
so an offline doctor run stays useful. In --format json these findings
use check: pinned_ref. See JSON output.
A pin that is merely behind its ref does not drift. A series tag moves
forward once per release, and the old release commit stays an ancestor of
the new one, so --check passes through ordinary releases. Use --update
to advance a pin. Investigate rewritten history before accepting a new SHA.