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

Function bisect_state

builtin/bisect.c:941–1020  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
942 const char **argv)
943{
944 const char *state;
945 int i, verify_expected = 1;
946 struct object_id oid, expected;
947 struct oid_array revs = OID_ARRAY_INIT;
948
949 if (!argc)
950 return error(_("Please call `--bisect-state` with at least one argument"));
951
952 if (bisect_autostart(terms))
953 return BISECT_FAILED;
954
955 state = argv[0];
956 if (check_and_set_terms(terms, state) ||
957 !one_of(state, terms->term_good, terms->term_bad, "skip", NULL))
958 return BISECT_FAILED;
959
960 argv++;
961 argc--;
962 if (argc > 1 && !strcmp(state, terms->term_bad))
963 return error(_("'git bisect %s' can take only one argument."), terms->term_bad);
964
965 if (argc == 0) {
966 const char *head = "BISECT_HEAD";
967 enum get_oid_result res_head = repo_get_oid(the_repository,
968 head, &oid);
969
970 if (res_head == MISSING_OBJECT) {
971 head = "HEAD";
972 res_head = repo_get_oid(the_repository, head, &oid);
973 }
974
975 if (res_head)
976 error(_("Bad rev input: %s"), head);
977 oid_array_append(&revs, &oid);
978 }
979
980 /*
981 * All input revs must be checked before executing bisect_write()
982 * to discard junk revs.
983 */
984
985 for (; argc; argc--, argv++) {
986 struct commit *commit;
987
988 if (repo_get_oid(the_repository, *argv, &oid)){
989 error(_("Bad rev input: %s"), *argv);
990 oid_array_clear(&revs);
991 return BISECT_FAILED;
992 }
993
994 commit = lookup_commit_reference(the_repository, &oid);
995 if (!commit)
996 die(_("Bad rev input (not a commit): %s"), *argv);
997
998 oid_array_append(&revs, &commit->object.oid);

Callers 3

bisect_skipFunction · 0.70
bisect_runFunction · 0.70
cmd_bisectFunction · 0.70

Calls 15

errorFunction · 0.85
bisect_autostartFunction · 0.85
check_and_set_termsFunction · 0.85
one_ofFunction · 0.85
repo_get_oidFunction · 0.85
oid_array_appendFunction · 0.85
oid_array_clearFunction · 0.85
lookup_commit_referenceFunction · 0.85
refs_read_refFunction · 0.85
get_main_ref_storeFunction · 0.85
bisect_writeFunction · 0.85
oid_to_hexFunction · 0.85

Tested by

no test coverage detected