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

Function bisect_reset

builtin/bisect.c:237–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237static 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
273static void log_commit(FILE *fp,
274 const char *fmt, const char *state,

Callers 2

bisect_replayFunction · 0.85
cmd_bisect__resetFunction · 0.85

Calls 11

strbuf_read_fileFunction · 0.85
strbuf_rtrimFunction · 0.85
repo_get_oid_commitFunction · 0.85
errorFunction · 0.85
strbuf_addstrFunction · 0.85
refs_ref_existsFunction · 0.85
get_main_ref_storeFunction · 0.85
strvec_pushlFunction · 0.85
run_commandFunction · 0.85
strbuf_releaseFunction · 0.85
bisect_clean_stateFunction · 0.85

Tested by

no test coverage detected