Skip to main content

Module worktree

Module worktree 

Source
Expand description

mkit worktree — manage linked working trees (#493 Phase 2).

add <path> [<commit-ish>], list [--porcelain], remove [--force] <path>, prune [--dry-run], with git’s semantics: every linked tree shares the one object store and the shared refs; each tree has its own HEAD, index, and in-progress-op state (see mkit_core::layout for the split). Registry mutations serialise on the common-dir worktrees.lock.

Crash-ordering in add: the per-tree state dir (commondir, back-pointer, HEAD) is fully written BEFORE the tree’s pointer file, so a crash in between leaves only a prunable registry orphan, never a tree that points at half-built state. Materialization runs last, into a fresh directory — a crash mid-restore leaves a valid worktree with missing files that checkout --force heals.

Functions§

run