feat(vcs): jj-aware git backend, incl. Jujutsu workspace support - #2571
feat(vcs): jj-aware git backend, incl. Jujutsu workspace support#2571lamalex wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Jujutsu (jj) awareness to the VCS layer by introducing a JjAwareGit wrapper that delegates to the existing Git backend while overriding behaviors that are inaccurate in colocated/secondary jj workspaces.
Changes:
- Expose a new
jjmodule and re-exportJjAwareGitfrom themoon_vcscrate. - Implement
JjAwareGitto queryjjfor working-copy label, revision, and changed files (especially for secondary workspaces). - Update session initialization to wrap Git with
JjAwareGitwhen a jj workspace is detected.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/vcs/src/lib.rs | Exposes the new jj module and re-exports JjAwareGit for downstream usage. |
| crates/vcs/src/jj.rs | Implements the JjAwareGit VCS adapter and parses jj diff --summary output. |
| crates/app/src/session.rs | Detects jj workspaces at runtime and selects JjAwareGit vs plain Git. |
| pub fn is_jj_workspace(git: &Git) -> bool { | ||
| std::process::Command::new("jj") | ||
| .arg("root") | ||
| .current_dir(&git.workspace_root) | ||
| .output() | ||
| .map(|out| out.status.success()) | ||
| .unwrap_or(false) | ||
| } |
| async fn setup_hooks(&self) -> miette::Result<Option<VcsHookEnvironment>> { | ||
| warn!( | ||
| "Jujutsu checkout detected: moon's git hooks won't run on `jj` commits or operations \ | ||
| (jj has no hook system). They remain active for plain-git contributors." | ||
| ); | ||
|
|
||
| self.git.setup_hooks().await | ||
| } |
| async fn jj_changed(&self, args: Vec<&str>) -> miette::Result<ChangedFiles> { | ||
| let output = self.jj.run(args, true).await?; | ||
|
|
||
| Ok(parse_changed_files(&output)) | ||
| } |
| for line in output.lines() { | ||
| let Some((status, path)) = line.trim_end().split_once(' ') else { | ||
| continue; | ||
| }; |
3325f75 to
031d471
Compare
Adds a `JjAwareGit` decorator that wraps the Git backend inside a Jujutsu workspace and routes working-copy/revision operations through jj. - Detect via `jj root`. - get_changed_files. - get_local_branch → bookmark at @ or short change-id. - get_local_branch_revision → @ commit id. - setup_hooks → still installs for git users, warns jj won't run them. - Everything else (file hashes/tree, repo root/slug) delegates to git. Auto-selected in session.rs when JjAwareGit::is_jj_workspace(). Plain-git checkouts and committed config are unaffected.
Merging this PR will degrade performance by 48.11%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | load_all |
100.1 ms | 195.9 ms | -48.9% |
| ❌ | WallTime | load_one |
27.7 ms | 53.5 ms | -48.27% |
| ❌ | WallTime | load_many |
42.9 ms | 81.1 ms | -47.13% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing lamalex:jj-vcs (b8e079d) with develop-2.4 (9f0e030)
|
I'm going to defer this till maybe v2.5, because I really have to think about the side-effects of this. |
Adds a
JjAwareGitdecorator that wraps the Git backend inside a Jujutsu workspace and routes working-copy/revision operations through jj.jj root.Auto-selected in session.rs when JjAwareGit::is_jj_workspace(). Plain-git checkouts and committed config are unaffected.