Repository navigation
feat(herdr-core): worktree actions and the branch line on the desktop app's runtime - #2899
Conversation
…line hc has no worktree API, so on herdr-core the sidebar hid New worktree, Open worktree and Delete worktree checkout, and no branch line showed. The adapter now answers worktree.list/create/open/remove by running git itself and opens a checkout as a workspace of its own; the workspace's worktree facts live in an ovis.worktree label so worktrees group under their repository. workspace.close honours close_group as herdr does, and ping offers layout.worktrees on cores whose layout Ovis keeps. Fixes #2823
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Review round for #2899: a workspace in a subfolder is a checkout's only when git says so (nested repositories); remove refuses a checkout moved away or replaced, compared by its own git folder kept in the label; git worktree list is read NUL-separated so quoted paths match; worktree calls are refused where the Herdr app arranges the core, and its labels are not read there; create and open run one at a time; open takes the path as given; a create whose shell fails undoes the checkout and its new branch.
…ened Second review round for #2899: git reuses .git/worktrees/<name> when a checkout is added again at the same path, so the label keeps that folder's file identity (device, inode, birth time) and remove refuses a checkout whose folder differs. An existing branch is checked out as it is whatever base was asked, as herdr and the dialog say. worktree.remove runs in the same queue as create and open.
Deploying ovis with
|
| Latest commit: |
88d0f6b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://47c11e83.ovis.pages.dev |
| Branch Preview URL: | https://fix-hc-worktree-actions.ovis.pages.dev |
|
Review at 88d0f6b: CLEAR (omo + Codex Terra xhigh), no HIGH or MEDIUM. CodeRabbit was rate-limited and did not review this head. Left as LOW follow-ups:
|
|
Local merge gate (owner-approved): reviewed head (omo CLEAR, threads resolved) with |
Summary
On a server running
OVIS_RUNTIME=herdr-core(the desktop app's runtime), a workspace on a gitrepository had no worktree actions and no branch line, because hc has no worktree API and the
actions were hidden (#2451). This makes them work there, following the first two directions in the issue.
server/herdr-core/adapter.tsnow answers herdr'sworktree.list,worktree.create,worktree.openandworktree.removeby running git itself (server/herdr-core/worktrees.ts).Answers and error codes follow herdr's:
not_git_worktree,linked_worktree_source,worktree_create_failed(a repository with no commit is refused with git's own wording, whichthe route already turns into
repository_without_commits; newer git would otherwise make anorphan branch),
worktree_not_found,ambiguous_worktree_branch,not_linked_worktree,dirty_worktree_requires_force. A checkout opens as a workspace of its own (a shell in itsfolder, like New workspace); the default folder is herdr's
~/.herdr/worktrees/<repo>/<branch>.worktreefacts are kept in anovis.worktreeterminal label, so thesnapshot marks worktree workspaces and their repository's workspace, and the sidebar groups them.
New tabs, splits and moved panes carry or drop the label.
workspace.closefollows herdr's group rule: a repository workspace with open worktrees needsclose_group, and closes them with it.pingreportslayout.worktrees(only on a core whose layout Ovis keeps), andappLayoutOfoffers the worktree items from it instead of always hiding them on herdr-core.
Fixes #2823
Validation
server/herdr-core/adapter.test.ts -t worktree,fake hc + a real git repository in a temp folder) fail on main and pass here.
bun test server/herdr-core src/lib/machineContext.test.ts src/components/*.appLayout.test.tsx server/workspace-routes.test.ts src/lib/useWorktreeBranches.hook.test.ts: pass; conventions tests pass;bun run typecheckpasses.OVIS_TEST_HC_BIN=<hc 0.1.14 from ci.yml> bun test ./server/herdr-core/live.test.ts: 7 pass.OVIS_RUNTIME=herdr-coreserver on loopback with atemp state dir: health says
worktrees: true; through the HTTP routes, list, create, open again(
already_open), close head without group (refused), remove dirty (refused) / forced (foldergone), close group (both closed, clean checkout kept). In the browser the repository row shows
mainunder its name with the worktree grouped below, and its menu lists Pin, Rename, Earliersessions, Close group, New worktree, Open worktree…, Collapse.
bun run check fastat 88d0f6b (contains main): workflow syntax, generated types/themes, typecheck, unit tests and build all ok (exit 0).Review rounds
git worktree list, worktree calls on a core the Herdr app arranges, concurrent opens, trimmed open paths, a failed shell aftergit worktree add. Fixed in 5580fcf with a failing-first test..git/worktrees/<name>for a checkout added again at the same path, and an existing branch with a base was refused. The label now keeps the git folder's file identity; an existing branch ignores the base as herdr does; remove runs in the same queue. Fixed in bf28854, test extended (fails before, passes after).