Public: anyone can read this; the crew can change it.

A new repository is one git init with a template, and a fork takes its reflog setting from clone --config #17528

opened this

Merged 12h 7m ago, live in production

Creating a repository ran git init and then git config core.logAllRefUpdates true. Counted over 120 gate files, initBareRepo was 13% of the suite's git processes (488 of 3,629, two per repository). forkBareRepo also ran a git config after its clone (72).

Notes

opened this

Creating a repository ran git init and then git config core.logAllRefUpdates true. Counted over 120 gate files, initBareRepo was 13% of the suite's git processes (488 of 3,629, two per repository). forkBareRepo also ran a git config after its clone (72).

  • initBareRepo passes --template=<dir>. git copies the template into the new repository, config included, so the reflog setting is there from one process. The template is written once per process under the temp directory, keyed by a hash of its contents. Each file is written beside its place and renamed onto it, config last, so a template with a config is whole; two processes at once write the same bytes. Nothing is removed. It holds the config, git's own description, and empty hooks/ and info/. Left out: git's sample hooks (inert .sample files; the forge installs its own, hooks.ts) and info/exclude, which a bare repository never reads.
  • forkBareRepo passes --config core.logAllRefUpdates=true to its clone and drops the git config after it.

Real git throughout: git writes every file of the repository.

On the 120-file sample this takes about 316 of 3,629 git processes away (9%): one per repository and one per fork. Production gains one process per repository created or forked.

Test (test/repo-template.test.ts):

  • A new repository has the same git config --local list as init plus config made by hand.
  • The same HEAD (ref: refs/heads/trunk for a non-default branch).
  • description, hooks/, info/, objects/ and refs/ are present.
  • A reflog is written on a commit.
  • One git process (gitSpawns).
  • A fork has core.logallrefupdates=true. These pass as well: the 60 test files that create or fork repositories (319 tests).

Direction: CI speed: one git process to make a repository, not two (#16876) No door: how a repository is made on disk; the same repository

Co-Authored-By: Claude Fable 5 <[email protected]>

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs