MCPcopy Create free account
hub / github.com/git/git / cmd_bisect

Function cmd_bisect

builtin/bisect.c:1445–1492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1443}
1444
1445int 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}

Callers

nothing calls this directly

Calls 11

parse_optionsFunction · 0.85
usage_msg_optFunction · 0.85
usage_with_optionsFunction · 0.85
set_termsFunction · 0.85
get_termsFunction · 0.85
check_and_set_termsFunction · 0.85
one_ofFunction · 0.85
usage_msg_optfFunction · 0.85
free_termsFunction · 0.85
is_bisect_successFunction · 0.85
bisect_stateFunction · 0.70

Tested by

no test coverage detected