Documentation
¶
Overview ¶
Package worktree isolates a delegated agent in its own copy of a git repository, so two sub-agents working in parallel do not tread on each other's files.
A git worktree is a second checkout sharing one object store: cheap to create, and its own working directory. A sub-agent given one can edit, build, and commit without the parent's tree or another sibling's tree changing under it. When the sub-agent is done, an unchanged worktree is removed; one with work in it is left for a person to look at.
None of this needs anything but git. Where git is absent, or the workspace is not a repository, isolation is simply unavailable and the caller falls back to the shared workspace — reported, never fatal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Worktree ¶
type Worktree struct {
// Path is the working directory the agent should use.
Path string
// Branch is the throwaway branch the worktree is on.
Branch string
// contains filtered or unexported fields
}
Worktree is one isolated checkout.
func Create ¶
Create makes a worktree off the workspace's repository. label is worked into the branch and directory names so a person can tell whose it is.
func (*Worktree) Cleanup ¶
Cleanup removes an unchanged worktree and leaves a changed one, returning a sentence describing what it did for the delegating agent to relay.