Skip to content

Commit e83e92e

Browse files
pks-tgitster
authored andcommitted
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>
1 parent d465be2 commit e83e92e

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

builtin/gc.c

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,23 +1835,37 @@ struct maintenance_strategy {
18351835
};
18361836

18371837
static const struct maintenance_strategy none_strategy = { 0 };
1838+
18381839
static const struct maintenance_strategy default_strategy = {
18391840
.tasks = {
1840-
[TASK_GC].enabled = 1,
1841+
[TASK_GC] = {
1842+
.enabled = 1,
1843+
},
18411844
},
18421845
};
1846+
18431847
static const struct maintenance_strategy incremental_strategy = {
18441848
.tasks = {
1845-
[TASK_COMMIT_GRAPH].enabled = 1,
1846-
[TASK_COMMIT_GRAPH].schedule = SCHEDULE_HOURLY,
1847-
[TASK_PREFETCH].enabled = 1,
1848-
[TASK_PREFETCH].schedule = SCHEDULE_HOURLY,
1849-
[TASK_INCREMENTAL_REPACK].enabled = 1,
1850-
[TASK_INCREMENTAL_REPACK].schedule = SCHEDULE_DAILY,
1851-
[TASK_LOOSE_OBJECTS].enabled = 1,
1852-
[TASK_LOOSE_OBJECTS].schedule = SCHEDULE_DAILY,
1853-
[TASK_PACK_REFS].enabled = 1,
1854-
[TASK_PACK_REFS].schedule = SCHEDULE_WEEKLY,
1849+
[TASK_COMMIT_GRAPH] = {
1850+
.enabled = 1,
1851+
.schedule = SCHEDULE_HOURLY,
1852+
},
1853+
[TASK_PREFETCH] = {
1854+
.enabled = 1,
1855+
.schedule = SCHEDULE_HOURLY,
1856+
},
1857+
[TASK_INCREMENTAL_REPACK] = {
1858+
.enabled = 1,
1859+
.schedule = SCHEDULE_DAILY,
1860+
},
1861+
[TASK_LOOSE_OBJECTS] = {
1862+
.enabled = 1,
1863+
.schedule = SCHEDULE_DAILY,
1864+
},
1865+
[TASK_PACK_REFS] = {
1866+
.enabled = 1,
1867+
.schedule = SCHEDULE_WEEKLY,
1868+
},
18551869
},
18561870
};
18571871

0 commit comments

Comments
 (0)