diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-10-24 08:57:19 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-10-24 13:42:44 -0700 |
| commit | e83e92e87672def24d971cdfef801bb0de0d5955 (patch) | |
| tree | 462eb9fb131be6214d5c256a364552d967f7ffc4 /builtin/gc.c | |
| parent | d465be2327d934f3506d412cc4f4067baba0d1c5 (diff) | |
| download | git-e83e92e87672def24d971cdfef801bb0de0d5955.tar.gz | |
builtin/maintenance: improve readability of strategies
Our maintenance strategies are essentially a large array of structures,
where each of the tasks can be enabled and scheduled individually. With
the current layout though all the configuration sits on the same nesting
layer, which makes it a bit hard to discern which initialized fields
belong to what task.
Improve readability of the individual tasks by using nested designated
initializers instead.
Suggested-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/gc.c')
| -rw-r--r-- | builtin/gc.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 726d944d3b..0ba6e59de1 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1835,23 +1835,37 @@ struct maintenance_strategy { }; static const struct maintenance_strategy none_strategy = { 0 }; + static const struct maintenance_strategy default_strategy = { .tasks = { - [TASK_GC].enabled = 1, + [TASK_GC] = { + .enabled = 1, + }, }, }; + static const struct maintenance_strategy incremental_strategy = { .tasks = { - [TASK_COMMIT_GRAPH].enabled = 1, - [TASK_COMMIT_GRAPH].schedule = SCHEDULE_HOURLY, - [TASK_PREFETCH].enabled = 1, - [TASK_PREFETCH].schedule = SCHEDULE_HOURLY, - [TASK_INCREMENTAL_REPACK].enabled = 1, - [TASK_INCREMENTAL_REPACK].schedule = SCHEDULE_DAILY, - [TASK_LOOSE_OBJECTS].enabled = 1, - [TASK_LOOSE_OBJECTS].schedule = SCHEDULE_DAILY, - [TASK_PACK_REFS].enabled = 1, - [TASK_PACK_REFS].schedule = SCHEDULE_WEEKLY, + [TASK_COMMIT_GRAPH] = { + .enabled = 1, + .schedule = SCHEDULE_HOURLY, + }, + [TASK_PREFETCH] = { + .enabled = 1, + .schedule = SCHEDULE_HOURLY, + }, + [TASK_INCREMENTAL_REPACK] = { + .enabled = 1, + .schedule = SCHEDULE_DAILY, + }, + [TASK_LOOSE_OBJECTS] = { + .enabled = 1, + .schedule = SCHEDULE_DAILY, + }, + [TASK_PACK_REFS] = { + .enabled = 1, + .schedule = SCHEDULE_WEEKLY, + }, }, }; |
