Skip to content

Commit 3cf3369

Browse files
committed
Merge branch 'ps/maintenance-geometric'
"git maintenance" command learns the "geometric" strategy where it avoids doing maintenance tasks that rebuilds everything from scratch. * ps/maintenance-geometric: t7900: fix a flaky test due to git-repack always regenerating MIDX builtin/maintenance: introduce "geometric" strategy builtin/maintenance: make "gc" strategy accessible builtin/maintenance: extend "maintenance.strategy" to manual maintenance builtin/maintenance: run maintenance tasks depending on type builtin/maintenance: improve readability of strategies builtin/maintenance: don't silently ignore invalid strategy builtin/maintenance: make the geometric factor configurable builtin/maintenance: introduce "geometric-repack" task builtin/gc: make `too_many_loose_objects()` reusable without GC config builtin/gc: remove global `repack` variable
2 parents 5236467 + a426557 commit 3cf3369

File tree

3 files changed

+544
-63
lines changed

3 files changed

+544
-63
lines changed

Documentation/config/maintenance.adoc

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,36 @@ detach.
1616

1717
maintenance.strategy::
1818
This string config option provides a way to specify one of a few
19-
recommended schedules for background maintenance. This only affects
20-
which tasks are run during `git maintenance run --schedule=X`
21-
commands, provided no `--task=<task>` arguments are provided.
22-
Further, if a `maintenance.<task>.schedule` config value is set,
23-
then that value is used instead of the one provided by
24-
`maintenance.strategy`. The possible strategy strings are:
19+
recommended strategies for repository maintenance. This affects
20+
which tasks are run during `git maintenance run`, provided no
21+
`--task=<task>` arguments are provided. This setting impacts manual
22+
maintenance, auto-maintenance as well as scheduled maintenance. The
23+
tasks that run may be different depending on the maintenance type.
2524
+
26-
* `none`: This default setting implies no tasks are run at any schedule.
25+
The maintenance strategy can be further tweaked by setting
26+
`maintenance.<task>.enabled` and `maintenance.<task>.schedule`. If set, these
27+
values are used instead of the defaults provided by `maintenance.strategy`.
28+
+
29+
The possible strategies are:
30+
+
31+
* `none`: This strategy implies no tasks are run at all. This is the default
32+
strategy for scheduled maintenance.
33+
* `gc`: This strategy runs the `gc` task. This is the default strategy for
34+
manual maintenance.
35+
* `geometric`: This strategy performs geometric repacking of packfiles and
36+
keeps auxiliary data structures up-to-date. The strategy expires data in the
37+
reflog and removes worktrees that cannot be located anymore. When the
38+
geometric repacking strategy would decide to do an all-into-one repack, then
39+
the strategy generates a cruft pack for all unreachable objects. Objects that
40+
are already part of a cruft pack will be expired.
41+
+
42+
This repacking strategy is a full replacement for the `gc` strategy and is
43+
recommended for large repositories.
2744
* `incremental`: This setting optimizes for performing small maintenance
2845
activities that do not delete any data. This does not schedule the `gc`
2946
task, but runs the `prefetch` and `commit-graph` tasks hourly, the
3047
`loose-objects` and `incremental-repack` tasks daily, and the `pack-refs`
31-
task weekly.
48+
task weekly. Manual repository maintenance uses the `gc` task.
3249

3350
maintenance.<task>.enabled::
3451
This boolean config option controls whether the maintenance task
@@ -75,6 +92,22 @@ maintenance.incremental-repack.auto::
7592
number of pack-files not in the multi-pack-index is at least the value
7693
of `maintenance.incremental-repack.auto`. The default value is 10.
7794

95+
maintenance.geometric-repack.auto::
96+
This integer config option controls how often the `geometric-repack`
97+
task should be run as part of `git maintenance run --auto`. If zero,
98+
then the `geometric-repack` task will not run with the `--auto`
99+
option. A negative value will force the task to run every time.
100+
Otherwise, a positive value implies the command should run either when
101+
there are packfiles that need to be merged together to retain the
102+
geometric progression, or when there are at least this many loose
103+
objects that would be written into a new packfile. The default value is
104+
100.
105+
106+
maintenance.geometric-repack.splitFactor::
107+
This integer config option controls the factor used for the geometric
108+
sequence. See the `--geometric=` option in linkgit:git-repack[1] for
109+
more details. Defaults to `2`.
110+
78111
maintenance.reflog-expire.auto::
79112
This integer config option controls how often the `reflog-expire` task
80113
should be run as part of `git maintenance run --auto`. If zero, then

0 commit comments

Comments
 (0)