1465
return strbuf_detach(&sb, NULL);
1466
}
1467
1468
+static char const * const builtin_maintenance_register_usage[] = {
1469
+ N_("git maintenance register"),
1470
+ NULL
1471
+};
1472
+
1473
static int maintenance_register(int argc, const char **argv, const char *prefix)
1474
{
1475
+ struct option options[] = {
1476
+ OPT_END(),
1477
+ };
1478
int rc;
1479
char *config_value;
1480
struct child_process config_set = CHILD_PROCESS_INIT;
1481
struct child_process config_get = CHILD_PROCESS_INIT;
1482
char *maintpath = get_maintpath();
1483
1484
+ argc = parse_options(argc, argv, prefix, options,
1485
+ builtin_maintenance_register_usage, 0);
1486
+ if (argc)
1487
+ usage_with_options(builtin_maintenance_register_usage,
1488
+ options);
1489
+
1490
/* Disable foreground maintenance */
1491
git_config_set("maintenance.auto", "false");
1492
1523
return rc;
1524
}
1525
1526
+static char const * const builtin_maintenance_unregister_usage[] = {
1527
+ N_("git maintenance unregister"),
1528
+ NULL
1529
+};
1530
+
1531
static int maintenance_unregister(int argc, const char **argv, const char *prefix)
1532
{
1533
+ struct option options[] = {
1534
+ OPT_END(),
1535
+ };
1536
int rc;
1537
struct child_process config_unset = CHILD_PROCESS_INIT;
1538
char *maintpath = get_maintpath();
1539
1540
+ argc = parse_options(argc, argv, prefix, options,
1541
+ builtin_maintenance_unregister_usage, 0);
1542
+ if (argc)
1543
+ usage_with_options(builtin_maintenance_unregister_usage,
1544
+ options);
1545
+
1546
config_unset.git_cmd = 1;
1547
strvec_pushl(&config_unset.args, "config", "--global", "--unset",
1548
"--fixed-value", "maintenance.repo", maintpath, NULL);
2524
PARSE_OPT_NONEG, maintenance_opt_scheduler),
2525
OPT_END()
2526
};
2527
+ const char *register_args[] = { "register", NULL };
2528
2529
argc = parse_options(argc, argv, prefix, options,
2530
builtin_maintenance_start_usage, 0);
2534
opts.scheduler = resolve_scheduler(opts.scheduler);
2535
validate_scheduler(opts.scheduler);
2536
2508
- if (maintenance_register(0, NULL, NULL)) /* It doesn't take any args */
2537
+ if (maintenance_register(ARRAY_SIZE(register_args)-1, register_args, NULL))
2538
warning(_("failed to add repo to global config"));
2539
return update_background_schedule(&opts, 1);
2540
}
2541
2542
+static const char *const builtin_maintenance_stop_usage[] = {
2543
+ N_("git maintenance stop"),
2544
+ NULL
2545
+};
2546
+
2547
static int maintenance_stop(int argc, const char **argv, const char *prefix)
2548
{
2549
+ struct option options[] = {
2550
+ OPT_END()
2551
+ };
2552
+ argc = parse_options(argc, argv, prefix, options,
2553
+ builtin_maintenance_stop_usage, 0);
2554
+ if (argc)
2555
+ usage_with_options(builtin_maintenance_stop_usage, options);
2556
return update_background_schedule(NULL, 0);
2557
}
2558