SIGN IN SIGN UP

feat(branch-selector): group the composer's worktree branches by prefix

The section under the chat composer listing the branches checked out in the
repo's other worktrees was a flat wall of full refs headed "Worktrees (n)",
though every row in it is a branch. It now reads "Worktree branches (n)" across
all ten locales and shares the prefix tree the local and remote sections have
always used, so a repo running several `task/*` worktrees folds them under one
`task/` group instead of listing them side by side. Its groups follow the same
rule as theirs and start collapsed, so the section carries no expansion policy
of its own to remember.

The main working tree's branch is hoisted out of the trie and kept as the first
row, labelled with its full ref. Left in it would sort below every prefix group,
since groups sort before leaves, or vanish inside one, and "back to the project
root" would move around from repo to repo.

`worktreeBranchLeaves` becomes `worktreeBranchNodes`, and the row model's
`worktreeLeaves` becomes `worktreeNodes`, keeping the tri-state contract that
tells a surface with no worktree section at all (`null`, the git-log branch
filter) from one whose repo simply has no other worktree (`[]`, the "(0)" header
plus an empty row, so the local block never shifts position between repos). The
header counts leaves rather than nodes, so a group stands for the branches under
it. Searching the section now scores the grouped label as well as the full ref,
which is what the other two sections have always done: a branch whose visible
label is exactly the query outranks one that merely contains it.
X
xintaofei committed
7db1dccfd680999a22772e2b19427f2a83ab1593
Parent: 2c382d2