Worktrees

The named worktrees of one checkout: create, sync, park, finalize, remove, read and lease them (trove-parts §TPW).

Group libtrove

In the namespace octomy::trove::git. Declared in src/libs/libworktree/worktree/Worktrees.hpp.

Detailed description

A worktree has a name, and its branch and its folder have that name too. The operations keep the contracts that the lane model had before the split: a second create is a no-op, a sync rebases onto the integration target and aborts on a conflict, and a park keeps unmerged work on `wip/<name>` before the worktree goes. A finalize aborts a conflicted rebase and names the paths. A remove never deletes the branch.

A name is one valid git branch component (§TPW-3). Each write checks it first, so a name from outside the process cannot become a git option or a path outside the worktree folder.

With a WorktreeLeases store, a write (sync, park, finalize, remove) needs the caller's lease or no live lease at all (§TPW-4). A create and the reads need none. Without a store, every write is permitted, as before the leases.

A sync fetches over the network. A caller on the thread of a window calls prepareSync() there, and runs runSync() on another thread. runSync() reads only its PreparedWrite, a copy of the orchestrator and the names, so it touches no object of the caller's thread.

list() reads every worktree with one `git worktree list –porcelain`, never one per worktree (§TPT-5).

Each message starts with a subject, by default `worktree <name>`. Trove's lanes pass `lane <N>`, so an operator reads the same messages as before.

Each git command runs through octomy::trove::git::GitOrchestrator.

See also octomy::trove::git::WorktreeLeases.

In this section