Run it
Set the project up as Installation describes and run the file. It needs Git and nothing else:Terminal
Output
revision is the HEAD read from the child worktree, anchor the digest
of the captured anchor the lease covered, and branch the Git ref of the
child branch.
The file
examples/workspace.ts
- Repository. It creates a Git repository with a committed
README.md. - Anchor. It captures the repository and verifies the anchor before use.
- Lease and fork. It acquires one writer lease and creates a child worktree from the captured revision.
- Child state. It reads the child
HEADandREADME.md, and throws if the revision or the file contents differ from the captured repository. - Cleanup. A
finallyblock removes the temporary root, which holds both the repository and its sibling worktree directory.
Next steps
- Workspace contract: scoped capture, leases, the fork failure kinds and where child worktrees live.
- Workspace:
isolated(), the step wrapper that runs this cycle and lands the work back on pass.