mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-24 02:24:25 -05:00
Every `git commit` forks `git maintenance run --auto --quiet --detach`,
and git 2.54 changed what that runs from the `gc` task to the
"geometric" strategy. The geometric repack's auto condition passes its
threshold of 100 to too_many_loose_objects(), which estimates the loose
object count from the objects/17 fanout directory times 256, so the real
trigger is two objects in that one directory -- where the old gc task
needed 27. Fixture repos reach two easily: every CreateNCommits(n>=6)
repo already stores the blob for file06.txt there, so a single commit
object hashing into 17 (about 4% of fixtures with 10 commits, 15% with
40) tips it over, and from then on every commit in that repo forks a
detached `git repack -d`, which prunes loose objects while the next
fixture command -- or lazygit under test -- is still working in the same
repo.
That is where the CI panics during fixture setup come from:
panic: error running command: [git commit -m commit-10]
error: invalid object 100644 50d5612... for 'file09.txt'
error: Error building trees
The reported hashes are exactly the fixture blobs, so `git add` staged
them correctly; they were unlinked underneath the commit. Only the
"git latest" jobs saw this, since the pinned 2.32/2.38/2.44 jobs predate
the strategy change.
git's own test suite guards against the same thing by exporting
GIT_TEST_MAINT_AUTO_DETACH=false ("Ensure that tests cannot race with
background maintenance by default"). Turning maintenance off outright is
stronger: no test repo needs it, and it also spares us a forked git
process per commit. maintenance.auto has been honored since git 2.29, so
it covers every version in the CI matrix.
Measured on a 40-commit fixture: a background repack fired in 4 of 25
runs before, 0 of 25 after.
20 lines
834 B
Plaintext
20 lines
834 B
Plaintext
# This is the global git config we use for all our integration tests
|
|
|
|
[user]
|
|
name = CI
|
|
email = CI@example.com
|
|
[protocol "file"]
|
|
# see https://vielmetti.typepad.com/logbook/2022/10/git-security-fixes-lead-to-fatal-transport-file-not-allowed-error-in-ci-systems-cve-2022-39253.html
|
|
allow = always
|
|
[commit]
|
|
gpgSign = false
|
|
[maintenance]
|
|
# Every `git commit` forks `git maintenance run --auto --detach`. Since git
|
|
# 2.54 that repacks as soon as two objects share the objects/17 fanout
|
|
# directory, which happens readily in a fixture repo, and `git repack -d`
|
|
# prunes loose objects while the next fixture command -- or lazygit itself --
|
|
# is still working in the same repo. That surfaces as
|
|
# "error: invalid object <hash> for 'file09.txt'" / "Error building trees".
|
|
# Tests must never race a background repack.
|
|
auto = false
|