Skip to content

feat(vcs): jj-aware git backend, incl. Jujutsu workspace support - #2571

Closed
lamalex wants to merge 1 commit into
moonrepo:develop-2.4from
lamalex:jj-vcs
Closed

feat(vcs): jj-aware git backend, incl. Jujutsu workspace support#2571
lamalex wants to merge 1 commit into
moonrepo:develop-2.4from
lamalex:jj-vcs

Conversation

@lamalex

@lamalex lamalex commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings June 15, 2026 13:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 jj module and re-export JjAwareGit from the moon_vcs crate.
  • Implement JjAwareGit to query jj for working-copy label, revision, and changed files (especially for secondary workspaces).
  • Update session initialization to wrap Git with JjAwareGit when 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.

Comment thread crates/vcs/src/jj.rs
Comment on lines +40 to +47
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)
}
Comment thread crates/vcs/src/jj.rs
Comment on lines +112 to +119
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
}
Comment thread crates/vcs/src/jj.rs Outdated
Comment on lines +61 to +65
async fn jj_changed(&self, args: Vec<&str>) -> miette::Result<ChangedFiles> {
let output = self.jj.run(args, true).await?;

Ok(parse_changed_files(&output))
}
Comment thread crates/vcs/src/jj.rs
Comment on lines +255 to +258
for line in output.lines() {
let Some((status, path)) = line.trim_end().split_once(' ') else {
continue;
};
@lamalex
lamalex changed the base branch from master to develop-2.4 June 15, 2026 17:08
@lamalex
lamalex changed the base branch from develop-2.4 to master June 15, 2026 17:11
@lamalex
lamalex changed the base branch from master to develop-2.4 June 15, 2026 17:11
@lamalex
lamalex force-pushed the jj-vcs branch 3 times, most recently from 3325f75 to 031d471 Compare June 16, 2026 13:26
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.
@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 48.11%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 3 regressed benchmarks
✅ 20 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

@milesj

milesj commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

I'm going to defer this till maybe v2.5, because I really have to think about the side-effects of this.

@milesj
milesj deleted the branch moonrepo:develop-2.4 July 5, 2026 19:25
@milesj milesj closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants