GitRefBaseline

Produces the baseline schema for a git ref by recomputing it from source — the heart of the git-ref-live model (design §5). There is no committed baseline to go stale or be overwritten; the target ref's source is checked out into a throwaway worktree and the schema extracted there, so the staleness gap is structurally impossible.

Fail-closed: an unresolvable ref throws (via GitCommands) rather than letting the gate pass. A content-addressed SnapshotCache avoids recomputing an unchanged ref.

Constructors

Link copied to clipboard
constructor(git: GitCommands)

Functions

Link copied to clipboard

Resolves ref to its full commit SHA; throws if the ref is unknown.

Link copied to clipboard
fun snapshotAt(ref: String, parentDir: File, cache: SnapshotCache, extract: (File) -> String): String

Returns the serialized snapshot for ref, extracting it in a worktree via extract on a cache miss and caching the result by SHA.

Link copied to clipboard
fun <T> withWorktree(ref: String, parentDir: File, block: (File) -> T): T

Materializes ref into a detached worktree under parentDir, runs block with its directory, and removes the worktree afterward (even on failure).