| 235 | } |
| 236 | |
| 237 | static int bisect_reset(const char *commit) |
| 238 | { |
| 239 | struct strbuf branch = STRBUF_INIT; |
| 240 | |
| 241 | if (!commit) { |
| 242 | if (!strbuf_read_file(&branch, git_path_bisect_start(), 0)) |
| 243 | printf(_("We are not bisecting.\n")); |
| 244 | else |
| 245 | strbuf_rtrim(&branch); |
| 246 | } else { |
| 247 | struct object_id oid; |
| 248 | |
| 249 | if (repo_get_oid_commit(the_repository, commit, &oid)) |
| 250 | return error(_("'%s' is not a valid commit"), commit); |
| 251 | strbuf_addstr(&branch, commit); |
| 252 | } |
| 253 | |
| 254 | if (branch.len && !refs_ref_exists(get_main_ref_store(the_repository), "BISECT_HEAD")) { |
| 255 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 256 | |
| 257 | cmd.git_cmd = 1; |
| 258 | strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees", |
| 259 | branch.buf, "--", NULL); |
| 260 | if (run_command(&cmd)) { |
| 261 | error(_("could not check out original" |
| 262 | " HEAD '%s'. Try 'git bisect" |
| 263 | " reset <commit>'."), branch.buf); |
| 264 | strbuf_release(&branch); |
| 265 | return -1; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | strbuf_release(&branch); |
| 270 | return bisect_clean_state(); |
| 271 | } |
| 272 | |
| 273 | static void log_commit(FILE *fp, |
| 274 | const char *fmt, const char *state, |
no test coverage detected