Skip to content

Commit 95b5039

Browse files
pks-tgitster
authored andcommitted
builtin/gc: use designated field initializers for maintenance tasks
Convert the array of maintenance tasks to use designated field initializers. This makes it easier to add more fields to the struct without having to modify all tasks. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 845c48a commit 95b5039

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

builtin/gc.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,49 +1550,49 @@ enum maintenance_task_label {
15501550

15511551
static struct maintenance_task tasks[] = {
15521552
[TASK_PREFETCH] = {
1553-
"prefetch",
1554-
maintenance_task_prefetch,
1553+
.name = "prefetch",
1554+
.fn = maintenance_task_prefetch,
15551555
},
15561556
[TASK_LOOSE_OBJECTS] = {
1557-
"loose-objects",
1558-
maintenance_task_loose_objects,
1559-
loose_object_auto_condition,
1557+
.name = "loose-objects",
1558+
.fn = maintenance_task_loose_objects,
1559+
.auto_condition = loose_object_auto_condition,
15601560
},
15611561
[TASK_INCREMENTAL_REPACK] = {
1562-
"incremental-repack",
1563-
maintenance_task_incremental_repack,
1564-
incremental_repack_auto_condition,
1562+
.name = "incremental-repack",
1563+
.fn = maintenance_task_incremental_repack,
1564+
.auto_condition = incremental_repack_auto_condition,
15651565
},
15661566
[TASK_GC] = {
1567-
"gc",
1568-
maintenance_task_gc,
1569-
need_to_gc,
1570-
1,
1567+
.name = "gc",
1568+
.fn = maintenance_task_gc,
1569+
.auto_condition = need_to_gc,
1570+
.enabled = 1,
15711571
},
15721572
[TASK_COMMIT_GRAPH] = {
1573-
"commit-graph",
1574-
maintenance_task_commit_graph,
1575-
should_write_commit_graph,
1573+
.name = "commit-graph",
1574+
.fn = maintenance_task_commit_graph,
1575+
.auto_condition = should_write_commit_graph,
15761576
},
15771577
[TASK_PACK_REFS] = {
1578-
"pack-refs",
1579-
maintenance_task_pack_refs,
1580-
pack_refs_condition,
1578+
.name = "pack-refs",
1579+
.fn = maintenance_task_pack_refs,
1580+
.auto_condition = pack_refs_condition,
15811581
},
15821582
[TASK_REFLOG_EXPIRE] = {
1583-
"reflog-expire",
1584-
maintenance_task_reflog_expire,
1585-
reflog_expire_condition,
1583+
.name = "reflog-expire",
1584+
.fn = maintenance_task_reflog_expire,
1585+
.auto_condition = reflog_expire_condition,
15861586
},
15871587
[TASK_WORKTREE_PRUNE] = {
1588-
"worktree-prune",
1589-
maintenance_task_worktree_prune,
1590-
worktree_prune_condition,
1588+
.name = "worktree-prune",
1589+
.fn = maintenance_task_worktree_prune,
1590+
.auto_condition = worktree_prune_condition,
15911591
},
15921592
[TASK_RERERE_GC] = {
1593-
"rerere-gc",
1594-
maintenance_task_rerere_gc,
1595-
rerere_gc_condition,
1593+
.name = "rerere-gc",
1594+
.fn = maintenance_task_rerere_gc,
1595+
.auto_condition = rerere_gc_condition,
15961596
},
15971597
};
15981598

0 commit comments

Comments
 (0)