Expand description
Per-run git worktree management.
Every omne run creates a detached-HEAD worktree at
.omne/wt/<run_id>/ via git worktree add --detach. Detached HEAD
avoids git’s “branch already checked out” refusal on back-to-back
runs from the same branch (plan R5).
The module is a thin wrapper over the git binary (subprocess), not
libgit2, to stay consistent with the user’s own git installation and
hook configuration. The process pattern mirrors crate::github for
spawn-and-capture handling, with two local additions:
LC_ALL=Cis forced on every git invocation so stderr classifier substrings like"not a git repository"stay locale-independent.- A
GIT_TIMEOUTbounds each subprocess so a wedged git (corrupted index, stalled network filesystem) cannot hangomne runforever.
Path-length preflight: Windows’ default MAX_PATH is 260 characters;
worktree creation can fail with cryptic “Filename too long” errors on
long volume roots. preflight_volume_path_length warns at 80 chars
and errors at 120 before any state mutation happens.
Structs§
- Worktree
List - Cross-checked enumeration of per-run worktrees.
Enums§
- Error
- Remove
Mode - Whether
removemay discard uncommitted changes in the worktree.
Constants§
- GIT_
TIMEOUT - Upper bound on any single
git worktreesubprocess. Enough slack for slow NFS/SMB volumes without letting a wedged git stall the runner. - PATH_
LENGTH_ ERROR - Volume path length at which preflight fails outright.
- PATH_
LENGTH_ WARN - Volume path length at which a warning is emitted (plan R5 preflight).
Functions§
- create
- Create a detached-HEAD worktree at
.omne/wt/<run_id>. - list
- Enumerate per-run worktrees under
.omne/wt/, partitioned into healthy pairs plus filesystem-only and git-only orphans. - preflight_
volume_ path_ length - Check volume root path length against the plan’s thresholds.
- remove
- Remove a per-run worktree via
git worktree remove.