Skip to content

test(project): copy one template repository instead of building each with four git calls - #808

Merged
omartelo merged 1 commit into
mainfrom
test/project-windows
Oct 17, 2026
Merged

omartelo merged 1 commit into
mainfrom
test/project-windows

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

internal/project is the slowest package on the Windows runner (82s in the #807 run, 6s on Linux) and almost none of it is a slow test: the suite spawns git 1,431 times, about 57ms a process on Windows. Half of those only build fixtures, and initRepo, called by ~95 tests, ran four of them (init, config, add, commit) to reach the same repository every time.

  • initRepo builds that repository once per package run and hands each test an os.CopyFS copy plus one git update-index --refresh. The refresh is required: the copied index carries the template's inodes and ctimes, so the first git read would rewrite it, which TestSnapshotTreeLeavesTheRepositoryAlone catches.
  • Skip semantics are kept: a failed git init skips (no usable git), a failure after it fails the test. TestMain removes the template.
  • The author/committer env moves to testGitIdentity, shared by gitIn and the template build.

No assertion changes. Locally: git calls 1,431 → 1,036, package green at -count=5, go vet clean for linux, windows and darwin. The Windows number comes from this PR's Timings table.

@omartelo
omartelo merged commit 991e9d6 into main Oct 17, 2026
7 checks passed
@omartelo
omartelo deleted the test/project-windows branch October 17, 2026 18:32
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