Skip to content

test: cut git subprocess spawns in TestRepo::create() - #367

Merged
Ziinc merged 2 commits into
mainfrom
claude/ci-test-repo-fewer-git-spawns
Aug 28, 2026
Merged

test: cut git subprocess spawns in TestRepo::create()#367
Ziinc merged 2 commits into
mainfrom
claude/ci-test-repo-fewer-git-spawns

Conversation

@Ziinc

@Ziinc Ziinc commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Every Rust integration test builds its own repo via TestRepo::create() (src-tauri/tests/e2e_test_helpers.rs), which spawns a git init, then a redundant git branch -M <name> to rename the still-unborn default branch, then a git checkout -b <name> back onto that same name it had just been renamed to.
  • Replaces those three spawns with a single git init -b <name> (supported since git 2.28, well within what GitHub-hosted runners ship), producing an identical end state: repo initialized, on branch <name>, no commits yet.
  • Windows CI is dominated by process-spawn overhead: the windows-latest / rust / test job's ~663 tests take ~16 minutes largely because of many jj/git subprocess spawns per test (see individual tests like core_workspaces_test at 10s/subtest). TestRepo::create() runs on every one of those tests, so trimming 2 of its ~9 git spawns should add up.

Why this approach

Minimal, behavior-preserving change scoped to the shared setup helper used by both TestRepo::new() and TestRepo::with_remote() — no test files needed to change. Verified the new command sequence produces the same end state (git init -b <name> leaves the repo on the named branch with no commits, matching what init + branch -M + checkout -b produced) by running it standalone.

Test plan

  • CI's rust / test jobs (ubuntu, macos, windows) pass unchanged in this PR.
  • Spot check that TestRepo::default_branch() and get_default_branch()-dependent tests still pass (they rely on the init.defaultBranch git config, which is unchanged by this diff).
    Generated by Claude Code

Replace `git init` + `git branch -M <name>` + `git checkout -b <name>`
with a single `git init -b <name>`, removing 2 of the ~9 git process
spawns every integration test pays for setup. On Windows the
windows-latest rust CI job spends ~16 minutes running ~663 tests that
are dominated by jj/git process-spawn overhead rather than compute, so
cutting redundant spawns from the shared setup path used by every
TestRepo::new()/with_remote() call should add up across the suite.
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

@Ziinc
Ziinc merged commit c5b02ba into main Aug 28, 2026
14 checks passed
@Ziinc
Ziinc deleted the claude/ci-test-repo-fewer-git-spawns branch August 28, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant