| 939 | } |
| 940 | |
| 941 | static 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); |
no test coverage detected