MCPcopy Index your code
hub / github.com/git/git / ref_newer

Function ref_newer

commit-reach.c:700–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698}
699
700int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
701{
702 struct object *o;
703 struct commit *old_commit, *new_commit;
704 struct commit_list *old_commit_list = NULL;
705 int ret;
706
707 /*
708 * Both new_commit and old_commit must be commit-ish and new_commit is descendant of
709 * old_commit. Otherwise we require --force.
710 */
711 o = deref_tag(the_repository, parse_object(the_repository, old_oid),
712 NULL, 0);
713 if (!o || o->type != OBJ_COMMIT)
714 return 0;
715 old_commit = (struct commit *) o;
716
717 o = deref_tag(the_repository, parse_object(the_repository, new_oid),
718 NULL, 0);
719 if (!o || o->type != OBJ_COMMIT)
720 return 0;
721 new_commit = (struct commit *) o;
722
723 if (repo_parse_commit(the_repository, new_commit) < 0)
724 return 0;
725
726 commit_list_insert(old_commit, &old_commit_list);
727 ret = repo_is_descendant_of(the_repository,
728 new_commit, old_commit_list);
729 if (ret < 0)
730 exit(128);
731 commit_list_free(old_commit_list);
732 return ret;
733}
734
735/*
736 * Mimicking the real stack, this stack lives on the heap, avoiding stack

Callers 4

cmd_mainFunction · 0.85
set_ref_status_for_pushFunction · 0.85
cmd__reachFunction · 0.85
get_push_ref_statesFunction · 0.85

Calls 6

deref_tagFunction · 0.85
parse_objectFunction · 0.85
repo_parse_commitFunction · 0.85
commit_list_insertFunction · 0.85
repo_is_descendant_ofFunction · 0.85
commit_list_freeFunction · 0.85

Tested by 1

cmd__reachFunction · 0.68