| 1443 | } |
| 1444 | |
| 1445 | int cmd_bisect(int argc, |
| 1446 | const char **argv, |
| 1447 | const char *prefix, |
| 1448 | struct repository *repo) |
| 1449 | { |
| 1450 | int res = 0; |
| 1451 | parse_opt_subcommand_fn *fn = NULL; |
| 1452 | struct option options[] = { |
| 1453 | OPT_SUBCOMMAND("reset", &fn, cmd_bisect__reset), |
| 1454 | OPT_SUBCOMMAND("terms", &fn, cmd_bisect__terms), |
| 1455 | OPT_SUBCOMMAND("start", &fn, cmd_bisect__start), |
| 1456 | OPT_SUBCOMMAND("next", &fn, cmd_bisect__next), |
| 1457 | OPT_SUBCOMMAND("log", &fn, cmd_bisect__log), |
| 1458 | OPT_SUBCOMMAND("replay", &fn, cmd_bisect__replay), |
| 1459 | OPT_SUBCOMMAND("skip", &fn, cmd_bisect__skip), |
| 1460 | OPT_SUBCOMMAND("visualize", &fn, cmd_bisect__visualize), |
| 1461 | OPT_SUBCOMMAND("view", &fn, cmd_bisect__visualize), |
| 1462 | OPT_SUBCOMMAND("run", &fn, cmd_bisect__run), |
| 1463 | OPT_END() |
| 1464 | }; |
| 1465 | argc = parse_options(argc, argv, prefix, options, git_bisect_usage, |
| 1466 | PARSE_OPT_SUBCOMMAND_OPTIONAL); |
| 1467 | |
| 1468 | if (!fn) { |
| 1469 | struct bisect_terms terms = { 0 }; |
| 1470 | |
| 1471 | if (!argc) |
| 1472 | usage_msg_opt(_("need a command"), git_bisect_usage, options); |
| 1473 | |
| 1474 | if (!strcmp(argv[0], "help")) |
| 1475 | usage_with_options(git_bisect_usage, options); |
| 1476 | |
| 1477 | set_terms(&terms, "bad", "good"); |
| 1478 | get_terms(&terms); |
| 1479 | if (check_and_set_terms(&terms, argv[0]) || |
| 1480 | !one_of(argv[0], terms.term_good, terms.term_bad, NULL)) |
| 1481 | usage_msg_optf(_("unknown command: '%s'"), git_bisect_usage, |
| 1482 | options, argv[0]); |
| 1483 | res = bisect_state(&terms, argc, argv); |
| 1484 | free_terms(&terms); |
| 1485 | } else { |
| 1486 | argc--; |
| 1487 | argv++; |
| 1488 | res = fn(argc, argv, prefix, repo); |
| 1489 | } |
| 1490 | |
| 1491 | return is_bisect_success(res) ? 0 : -res; |
| 1492 | } |
nothing calls this directly
no test coverage detected