pub fn parse_worktrees(bytes: &[u8]) -> Result<Vec<Worktree>, String>Expand description
Parse git worktree list --porcelain -z.
NUL-terminated attribute
lines, an empty token closing each record, the attributes worktree,
HEAD, branch refs/heads/<name> (shortened here), bare,
detached, locked [reason], and prunable [reason].
§Errors
The detail of what could not be trusted: a first record that is not a
complete main worktree, a record missing its required attributes, an
unknown attribute shape, or a path that is not UTF-8 — each refuses
the whole inventory before any verb acts on a partial one. A bare
main record is refused by name: the sibling convention has no parent
checkout to compose with, and no verb here operates on a bare
repository. Destructive verbs sit on this parser, and nothing ever
inspects .git/worktrees/ directly; this is the one reader.