* We use the convention that return BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND (-10) means * the bisection process finished successfully. * In this case the calling function or command should not turn a * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND return code into an error or a non zero exit code. * * Checking BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND * in bisect_helper::bisect_next() and only transformin
| 1042 | * all the code related to finding a commit to test. |
| 1043 | */ |
| 1044 | enum bisect_error bisect_next_all(struct repository *r, const char *prefix) |
| 1045 | { |
| 1046 | struct strvec rev_argv = STRVEC_INIT; |
| 1047 | struct rev_info revs = REV_INFO_INIT; |
| 1048 | struct commit_list *tried = NULL; |
| 1049 | int reaches = 0, all = 0, nr, steps; |
| 1050 | enum bisect_error res = BISECT_OK; |
| 1051 | struct object_id *bisect_rev; |
| 1052 | char *steps_msg; |
| 1053 | /* |
| 1054 | * If no_checkout is non-zero, the bisection process does not |
| 1055 | * checkout the trial commit but instead simply updates BISECT_HEAD. |
| 1056 | */ |
| 1057 | int no_checkout = refs_ref_exists(get_main_ref_store(the_repository), |
| 1058 | "BISECT_HEAD"); |
| 1059 | unsigned bisect_flags = 0; |
| 1060 | |
| 1061 | read_bisect_terms(&term_bad, &term_good); |
| 1062 | if (read_bisect_refs()) |
| 1063 | die(_("reading bisect refs failed")); |
| 1064 | |
| 1065 | if (file_exists(git_path_bisect_first_parent())) |
| 1066 | bisect_flags |= FIND_BISECTION_FIRST_PARENT_ONLY; |
| 1067 | |
| 1068 | if (skipped_revs.nr) |
| 1069 | bisect_flags |= FIND_BISECTION_ALL; |
| 1070 | |
| 1071 | res = check_good_are_ancestors_of_bad(r, prefix, no_checkout); |
| 1072 | if (res) |
| 1073 | goto cleanup; |
| 1074 | |
| 1075 | bisect_rev_setup(r, &revs, &rev_argv, prefix, "%s", "^%s", 1); |
| 1076 | |
| 1077 | revs.first_parent_only = !!(bisect_flags & FIND_BISECTION_FIRST_PARENT_ONLY); |
| 1078 | revs.limited = 1; |
| 1079 | |
| 1080 | bisect_common(&revs); |
| 1081 | |
| 1082 | find_bisection(&revs.commits, &reaches, &all, bisect_flags); |
| 1083 | revs.commits = managed_skipped(revs.commits, &tried); |
| 1084 | |
| 1085 | if (!revs.commits) { |
| 1086 | /* |
| 1087 | * We should return error here only if the "bad" |
| 1088 | * commit is also a "skip" commit. |
| 1089 | */ |
| 1090 | res = error_if_skipped_commits(tried, NULL); |
| 1091 | if (res < 0) |
| 1092 | goto cleanup; |
| 1093 | printf(_("%s was both '%s' and '%s'\n"), |
| 1094 | oid_to_hex(current_bad_oid), |
| 1095 | term_good, |
| 1096 | term_bad); |
| 1097 | |
| 1098 | res = BISECT_FAILED; |
| 1099 | goto cleanup; |
| 1100 | } |
| 1101 |
no test coverage detected