Skip to main content

Module worktree

Module worktree 

Source
Expand description

git worktree wrapper for hermetic per-run workspaces.

The determinism harness uses this to obtain a clean copy of the workspace rooted at a specific commit, so .gitignored byproducts (target/, dist/, node_modules/, etc.) from prior runs cannot leak between builds.

Worktree::add constructs the worktree (detached HEAD at the supplied commit). Drop is best-effort: it runs git worktree remove --force against the parent repo so the temporary tree is cleaned up even on panic. Failure to remove is surfaced via tracing::warn! with the captured stderr — we never panic during Drop, but silent swallowing left operators with no signal when the cleanup raced an I/O error. Operators can still run git worktree prune to reap the stale administrative entry after such a leak.

Structs§

Worktree