Offer Jujutsu workspaces as checkouts too - #2151
Merged
Merged
Conversation
jj lays workspaces out the way git lays out worktrees - the first holds a .jj/repo directory, the rest hold a file naming it - so they fit the existing checkout model exactly. `jj workspace list' reports them, which means an unvisited one turns up like an unvisited git worktree does. The identity goes through jj's git backing store rather than stopping at .jj. A modern `jj git init' leaves a .git at the root, so the first workspace is detected as git while later ones are detected as jj; resolving both to the same git directory makes them agree on being one repository, and hands jj projects a remote (and so siblings) for free. The lookup keys off .jj rather than the detected system for the same reason - a colocated repository has both kinds of checkout and both belong on the list. Renames the worktree plist's :branch to :label, since for jj it holds a workspace name. Nothing outside this cycle used it. The dashboard's own :branch is a different thing and is untouched. Three things this needed getting right, all found by testing against a real jj rather than by reading its docs: - jj colorizes template output too, so anyone with `ui.color = "always"' was getting paths wrapped in escape sequences. Passes --color=never. - The remote check has to come before any file-system probe, or a TRAMP root costs an ssh connect in the code path written to avoid one. - The backing store can name a .git *file* rather than a directory - a submodule checkout does - and can name a linked worktree's git dir rather than the shared one. Both now resolve properly. CI installs a pinned jj so the specs run there; they self-skip without it.
`tar -xz -C dir jj' can't match a member spelled `./jj', which is what the release tarball actually contains. Extracting the archive whole and installing the binary out of it sidesteps member-name matching entirely, so it doesn't matter which tar the image ships.
Both still described a checkout as showing "the branch it has checked out", which stopped being the whole story once workspaces joined the list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that I can test against a real
jj, here's the workspace support I left out of #2147.jj lays workspaces out exactly the way git lays out worktrees, so they drop into the existing model.
jj workspace listenumerates them, so an unvisited workspace turns up the same way an unvisited git worktree does.The identity goes through jj's git backing store rather than stopping at
.jj. A modernjj git initleaves a.gitat the root, so the first workspace detects as git and later ones detect as jj - resolving both to the same git directory makes them agree they're one repository, and hands jj projects a remote (and therefore siblings) for free.The worktree plist's
:branchbecomes:label, since for jj it holds a workspace name. Nothing outside this unreleased cycle used it.Three things only turned up by running the real thing:
ui.color = "always"got paths wrapped in escape sequences and every candidate was a directory that didn't exist.--color=never.file-directory-p, or a TRAMP root costs an ssh connect in the code path written to avoid exactly that..gitfile instead of a directory - a submodule checkout does - and can point at a linked worktree's git dir rather than the shared one. Both are handled now, with a spec that builds a real submodule.CI installs a pinned jj alongside ripgrep; the specs self-skip without it.