]> git.ipfire.org Git - thirdparty/git.git/commit
maintenance: add loose-objects.batchSize config
authorDerrick Stolee <stolee@gmail.com>
Mon, 24 Mar 2025 00:51:51 +0000 (00:51 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Mar 2025 06:06:01 +0000 (23:06 -0700)
commit6540560fd6c91091f6cf1eaedd034bc1827e1506
tree9e5757f91fc449f73f72f12f68ec02f0426fdc76
parent286183da99e60258934790f6706b8db67b10dcab
maintenance: add loose-objects.batchSize config

The 'loose-objects' task of 'git maintenance run' first deletes loose
objects that exit within packfiles and then collects loose objects into
a packfile. This second step uses an implicit limit of fifty thousand
that cannot be modified by users.

Add a new config option that allows this limit to be adjusted or ignored
entirely.

While creating tests for this option, I noticed that actually there was
an off-by-one error due to the strict comparison in the limit check. I
considered making the limit check turn true on equality, but instead I
thought to use INT_MAX as a "no limit" barrier which should mean it's
never possible to hit the limit. Thus, a new decrement to the limit is
provided if the value is positive. (The restriction to positive values
is to avoid underflow if INT_MIN is configured.)

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/maintenance.adoc
Documentation/git-maintenance.adoc
builtin/gc.c
t/t7900-maintenance.sh