Files
paseo/public-docs
Mohamed Boudra 120df507a9 Start a workspace in an existing worktree, and branch off or check out any branch or pull request (#10190)
* feat(server): branch off a pull request and list every git worktree

A workspace.create worktree source with action "branch-off" and a
checkoutSource used to check the pull request out, because core took
any change request as a checkout. Branch-off now fetches the pull
request's head into a remote-tracking ref (origin/<head> for a
same-repo head, paseo-pr-<N>/<head> otherwise) and starts the new
branch there, with no upstream and no remote added. A request with no
action still checks the pull request out, as older clients expect.

checkout.worktrees.list returns all git worktrees of the repository,
not only the ones Paseo created, so the New workspace screen can offer
any of them. Bare and prunable entries are left out.

Hosts advertise both through server_info.features: worktreeRefActions
and checkoutWorktreeList. Older hosts ignore the branch-off action on a
pull request, so the app must gate on the flag.

* feat(app): pick an existing worktree, and branch off or check out a ref

Isolation now offers Project directory (was "Local"), New worktree, and
Existing worktree. Existing worktree is a local workspace at the chosen
worktree's path, not a third isolation value, so plugins, preferences, and
the create request still see "local". The list comes from
checkout.worktrees.list, so it includes worktrees Paseo did not create.

The ref picker gains Branches / Pull requests pills and a Branch off /
Check out toggle with a tooltip per action. Branches default to Branch off
and pull requests to Check out. On a host without worktreeRefActions the
toggle is hidden and the defaults apply.

Git keeps a branch in one worktree at a time. Picking a held branch in
Check out mode moves to the worktree that holds it, and creating from a
held branch that was never picked fails with an explanation. Without
this the server would silently check out a "<branch>-1" copy.

* docs: describe Existing worktree and Branch off / Check out

* fix(server): give a fork pull request branch-off a base the repository has

A branch off a fork's pull request stored the fork's head as its base, under
refs/remotes/paseo-pr-<N>. Create PR then asked for a pull request into a
branch the base repository does not have, and the ref piled up in base branch
pickers because no remote owns it. The new branch now starts at the fetched
head, kept under refs/paseo/change-requests/<N>, and its base is the pull
request's base branch. A same-repository branch-off still stacks on the pull
request's branch.

A routed create_workspace with a prNumber and no mode checks the pull request
out again, as before branch-off could start from a pull request.

The worktree list skips a locked worktree whose directory is gone, since it
cannot be opened.

* fix(app): start an existing worktree's agent in that worktree

Existing worktree created the workspace at the worktree, but the composer and
terminal still used the project directory, so the daemon rejected the first
agent as outside the workspace. The screen now derives one working directory
from the isolation and uses it for the workspace, the composer, and the
terminal. A worktree that left the list is no longer a choice.

The ref picker names change requests the way the project's forge does, so a
GitLab project shows Merge requests. The schedule form uses the isolation
labels Project directory and New worktree.

* fix(server): compare a fork pull request branch-off against the remote base

The base was stored as the bare branch name, which resolves to the local branch
first. A local main behind origin/main put upstream commits in the workspace's
changes for its whole life, and a base branch the clone never fetched failed
creation. The base branch is now fetched from origin and stored as its
remote-tracking ref.

* fix(server): take a pull request's base and a checked-out branch from the remote that has them

A fork branch-off fetched its base from origin. In a clone whose base
repository is upstream, origin is the user's fork or missing, so the base was
stale or the create failed. The base now comes from the remote that served the
pull request, and a failed base fetch falls back to the bare branch name.

Check out of a branch that only a remote other than origin has failed with an
unknown branch. The local branch is now created from the one remote-tracking
ref with that name, tracking it, as git does.

The fork branch-off test passes a git identity to commit-tree, which CI
runners do not have.

* fix(server): branch off a pull request from the remote that serves it

A same-repository pull request's head was fetched into refs/remotes/origin.
In a fork clone, upstream serves the pull request and origin is the fork, so
the base refresh replaced the head with the fork's branch of the same name and
the new branch started from code that is not the pull request. The head now
lands under refs/paseo/change-requests/<N>, the branch starts there, and the
base is fetched from the remote that served the head.

A routed create_workspace that branches off a pull request is refused, as it
is on the local host.

* fix(app): branch off a plugin's base ref whatever the branch action

setBaseRef chose the base but kept the user's Check out switch, so a plugin's base became a checkout or a held-branch error. A base is what a new worktree starts from, so setBaseRef switches branches back to Branch off.
2026-11-19 16:31:38 +07:00
..