Expand description
In-place checkpoint/revert for the optimization loop, using the git index.
The optimizer edits the scheduler crate in place on the current branch - it
creates no branch and makes no commits. The git index is used as the
checkpoint: an accepted round is staged (git add), and a rejected round is
reverted by restoring the working tree from the index (git checkout --),
which leaves earlier accepted changes intact and keeps cargo’s incremental
build cache warm. When the run ends the crate is unstaged, so the winning
variant is left as ordinary (uncommitted) working-tree modifications.
Functions§
- checkpoint
- Checkpoint the current crate state as accepted by staging it into the index.
- diff
- Diff of the crate dir between
base_refand the working tree. - discard
- Revert the crate working tree to the last checkpoint by restoring it from the index (the last accepted state, or the baseline if nothing is accepted yet).
- ensure_
clean - The crate directory must have no uncommitted changes before we start, so the index checkpoint begins at a known-clean baseline and a revert is safe.
- git 🔒
- rev_
parse - unstage
- Unstage the crate (reset the index to HEAD) while keeping working-tree edits, so an accepted result is left as plain uncommitted modifications.
- worktree_
diff - Diff of the crate dir between the index checkpoint and the working tree.