test: cut git subprocess spawns in TestRepo::create() - #367
Merged
Conversation
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.
Contributor
|
🚀 Web preview: https://preview-367.treq-9zy.pages.dev |
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.
Summary
TestRepo::create()(src-tauri/tests/e2e_test_helpers.rs), which spawns agit init, then a redundantgit branch -M <name>to rename the still-unborn default branch, then agit checkout -b <name>back onto that same name it had just been renamed to.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-latest / rust / testjob's ~663 tests take ~16 minutes largely because of many jj/git subprocess spawns per test (see individual tests likecore_workspaces_testat 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()andTestRepo::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 whatinit+branch -M+checkout -bproduced) by running it standalone.Test plan
rust / testjobs (ubuntu, macos, windows) pass unchanged in this PR.TestRepo::default_branch()andget_default_branch()-dependent tests still pass (they rely on theinit.defaultBranchgit config, which is unchanged by this diff).Generated by Claude Code