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

Function bisect_checkout

bisect.c:734–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732}
733
734enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
735 int no_checkout)
736{
737 struct commit *commit;
738 struct pretty_print_context pp = {0};
739 struct strbuf commit_msg = STRBUF_INIT;
740
741 refs_update_ref(get_main_ref_store(the_repository), NULL,
742 "BISECT_EXPECTED_REV", bisect_rev, NULL, 0,
743 UPDATE_REFS_DIE_ON_ERR);
744
745 if (no_checkout) {
746 refs_update_ref(get_main_ref_store(the_repository), NULL,
747 "BISECT_HEAD", bisect_rev, NULL, 0,
748 UPDATE_REFS_DIE_ON_ERR);
749 } else {
750 struct child_process cmd = CHILD_PROCESS_INIT;
751
752 cmd.git_cmd = 1;
753 strvec_pushl(&cmd.args, "checkout", "-q",
754 oid_to_hex(bisect_rev), "--", NULL);
755 if (run_command(&cmd))
756 /*
757 * Errors in `run_command()` itself, signaled by res < 0,
758 * and errors in the child process, signaled by res > 0
759 * can both be treated as regular BISECT_FAILED (-1).
760 */
761 return BISECT_FAILED;
762 }
763
764 commit = lookup_commit_reference(the_repository, bisect_rev);
765 repo_format_commit_message(the_repository, commit, "[%H] %s%n",
766 &commit_msg, &pp);
767 fputs(commit_msg.buf, stdout);
768 strbuf_release(&commit_msg);
769
770 return BISECT_OK;
771}
772
773static struct commit *get_commit_reference(struct repository *r,
774 const struct object_id *oid)

Callers 3

check_merge_basesFunction · 0.85
bisect_next_allFunction · 0.85
verify_goodFunction · 0.85

Calls 8

refs_update_refFunction · 0.85
get_main_ref_storeFunction · 0.85
strvec_pushlFunction · 0.85
oid_to_hexFunction · 0.85
run_commandFunction · 0.85
lookup_commit_referenceFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected