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

Function rollback_is_safe

sequencer.c:3453–3475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3451}
3452
3453static int rollback_is_safe(void)
3454{
3455 struct strbuf sb = STRBUF_INIT;
3456 struct object_id expected_head, actual_head;
3457
3458 if (strbuf_read_file(&sb, git_path_abort_safety_file(), 0) >= 0) {
3459 strbuf_trim(&sb);
3460 if (get_oid_hex(sb.buf, &expected_head)) {
3461 strbuf_release(&sb);
3462 die(_("could not parse %s"), git_path_abort_safety_file());
3463 }
3464 strbuf_release(&sb);
3465 }
3466 else if (errno == ENOENT)
3467 oidclr(&expected_head, the_repository->hash_algo);
3468 else
3469 die_errno(_("could not read '%s'"), git_path_abort_safety_file());
3470
3471 if (repo_get_oid(the_repository, "HEAD", &actual_head))
3472 oidclr(&actual_head, the_repository->hash_algo);
3473
3474 return oideq(&actual_head, &expected_head);
3475}
3476
3477static int reset_merge(const struct object_id *oid)
3478{

Callers 2

sequencer_rollbackFunction · 0.85
sequencer_skipFunction · 0.85

Calls 9

strbuf_read_fileFunction · 0.85
strbuf_trimFunction · 0.85
get_oid_hexFunction · 0.85
strbuf_releaseFunction · 0.85
oidclrFunction · 0.85
die_errnoFunction · 0.85
repo_get_oidFunction · 0.85
oideqFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected