feat(vcs): native jj (Jujutsu) support for .jj-only repos - #58
Merged
Conversation
Ignore .workspaces/ (jj workspace dogfood dir) on the git side.
Creates internal/jjfs and internal/vcs with exact public signatures defined by the design contracts, plus compile-time and runtime contract tests. Bodies are stubs (return ""); implementation lands in later tasks.
…nd lookup Pure-Go implementation of FindJJEntry, DetectMainRepo, and DetectGitBackend with behavior tests covering main workspace, secondary workspace pointer resolution, native relative git_target, and non-jj directories.
…tion Replaces stub bodies with DetectMainRepo (gitfs-first, jjfs fallback, canonicalized via core.NormalizePath) and DetectRemote (git-C first, jjfs backend fallback). Adds four behavior tests using the real git binary.
…cher - internal/api/resolver.go: replace gitfs.DetectMainRepo with vcs.DetectMainRepo so the worktree fallback supports both git linked worktrees and native jj workspaces; result is canonicalized via core.NormalizePath. - cmd/arc/paths.go: replace inline git shell-out in detectGitRemote with vcs.DetectRemote so arc init / arc paths add populate GitRemote from native jj repos (via the jj backing git directory). Remove now-unused os/exec import.
Add internal/testutil/jjtest with RequireJJ, Run, InitNative, AddRemote, and AddWorkspace helpers that shell out to the jj binary in isolated temp dirs. Add integration tests in internal/vcs that exercise DetectRemote and DetectMainRepo against a real native jj repo and secondary workspace.
Use 0o600 for test-written files and a named dirPerm/cfgPerm const in jjtest, matching the gittest idiom. No behavior change.
The jj release tarball nests the binary in a versioned directory, so 'tar -C /usr/local/bin jj' failed with 'jj: Not found in archive'. Extract the full archive and find the jj binary instead.
Replaces the fragile manual curl/tar download (which broke on the release tarball's nested binary layout) with the maintained taiki-e/install-action, pinned to jj 0.42.0.
taiki-e/install-action doesn't support jj and its cargo-binstall fallback fails (crate is jj-cli, not binstall-ready). The manual release-tarball download with a find-based binary locate works.
Accidentally committed during a gitignore investigation.
- resolver.go: update stale doc comment to cover jj secondary workspaces - jjfs.go: document the jj 0.42 on-disk layout assumptions + the DetectMainRepo layout derivation - vcs_test.go: add colocated-jj test proving git-first ordering when both .git and .jj are present - test.yml: add a 3x retry loop to the jj download (matches the Playwright install idiom) so a flaky fetch can't redden the unit gate
Contributor
Author
|
Note for reviewers: |
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.
Native jj (Jujutsu) support
Adds native Jujutsu support to arc for repos that have only a
.jjdirectory and no.git(i.e.jj git initwithout--colocate, orjj git clone). Implements Approach A from the design (epicarc-0ek8.03rhja).Problem
arc's VCS-aware features assumed git. In a native-jj repo, two things broke:
detectGitRemoteshelledgit remote get-url origin, which fails with no.git, leavingWorkspace.GitRemoteempty.Approach
jj's on-disk layout mirrors git worktrees, and jj's storage backend is a git repo — so this is clean, with no
jjbinary dependency in production:gitfs)jjfs).gitfile →gitdir:pointer.jj/repofile → relative pointer.gitdir.jj/repodir.gitrepo.jj/repo/store/git_target→ backing git dirChanges
internal/jjfs— pure-Go.jjdetection, secondary-workspace→main mapping, andgit_targetbackend resolution (mirrorsinternal/gitfs; relative and absolute pointers).internal/vcs— dispatcher:DetectMainRepo(git first, jj fallback, canonicalized viacore.NormalizePath) andDetectRemote(git first, jj backing git dir fallback). git-first ordering means existing git behavior is unchanged.internal/api/resolver.goandcmd/arc/paths.go'sdetectGitRemotenow route throughvcs.internal/testutil/jjtesthelper (shells real jj, skips when absent) + native-jj integration tests that pass against jj 0.42.jjbinary so the integration tests run.Testing
jjfs,vcs,jjtest,cmd/arc) all green;golangci-lintclean.jjbinary invoked in production code paths.Notes for reviewers
gitfs×3,api×2) are/var↔/private/varsymlink artifacts in git-worktree resolution — not caused by this PR, they pass on Linux CI. Tracked as follow-uparc-0ek8.08g0rw.e3cc36fis an empty workspace-setup artifact — safe to drop via squash-merge.Closes the work in epic
arc-0ek8.03rhja.