Skip to main content

Module revisions

Module revisions 

Source
Expand description

Git revision materialization (decided.services.revisions) — the only git-consuming module of the watchkeeper path (ADR-043). A revision name becomes a temporary directory holding the corpus subpath at that revision, via git archive --format=tar (never mutates .git: no worktree registration, no locks) piped through a minimal in-process tar reader (no tar binary, no new dependencies).

Contract mirrored from the oracle:

  • git rev-parse --show-toplevel (cwd = the corpus directory) finds the work-tree root; failure -> not a git repository: <directory>; a missing git binary -> git executable not found (both exit 2 at the CLI as decided: <msg>).
  • git rev-parse --verify --quiet <rev>^{commit} (cwd = repo root); nonzero -> unknown revision: <rev>.
  • git archive --format=tar <rev> -- <pathspec> (cwd = repo root); a NONZERO exit is not an error — the subpath does not exist at that revision and an EMPTY corpus is materialized (the fresh-adoption “everything added” comparison).
  • The temporary directory is prefixed decided-watchkeeper- and removed when the materialization guard drops. Its path never appears in any output surface (all reported paths are corpus-relative).

Structs§

MaterializedRevision
One materialized revision: the guard owns the temporary directory and removes it (best effort) on drop, like the oracle’s tempfile.TemporaryDirectory context.

Enums§

RevisionError
The two usage-error surfaces of revision resolution; message() is the text after the CLI’s decided: prefix.

Functions§

materialize_revision
materialized_revision(repo_root, rev, subpath) — verify the commit, archive the subpath, extract into a temp tree, and yield tmp/<subpath> (created empty when the archive had nothing to say).
repository_root
repository_root(directory) — the work-tree root containing directory.