@@ -728,9 +728,45 @@ static int maintenance_task_gc(struct maintenance_opts *opts)
return run_command(&child);
}
+typedef int maintenance_task_fn(struct maintenance_opts *opts);
+
+struct maintenance_task {
+ const char *name;
+ maintenance_task_fn *fn;
+ unsigned enabled:1;
+};
+
+enum maintenance_task_label {
+ TASK_GC,
+
+ /* Leave as final value */
+ TASK__COUNT
+};
+
+static struct maintenance_task tasks[] = {
+ [TASK_GC] = {
+ "gc",
+ maintenance_task_gc,
+ 1,
+ },
+};
+
static int maintenance_run(struct maintenance_opts *opts)
{
- return maintenance_task_gc(opts);
+ int i;
+ int result = 0;
+
+ for (i = 0; i < TASK__COUNT; i++) {
+ if (!tasks[i].enabled)
+ continue;
+
+ if (tasks[i].fn(opts)) {
+ error(_("task '%s' failed"), tasks[i].name);
+ result = 1;
+ }
+ }
+
+ return result;
}
int cmd_maintenance(int argc, const char **argv, const char *prefix)