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

Function lookup_commit_reference_gently

commit.c:42–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40const char *commit_type = "commit";
41
42struct commit *lookup_commit_reference_gently(struct repository *r,
43 const struct object_id *oid, int quiet)
44{
45 const struct object_id *maybe_peeled;
46 struct object_id peeled_oid;
47 struct commit *commit;
48 enum object_type type;
49
50 switch (peel_object_ext(r, oid, &peeled_oid, 0, &type)) {
51 case PEEL_NON_TAG:
52 maybe_peeled = oid;
53 break;
54 case PEEL_PEELED:
55 maybe_peeled = &peeled_oid;
56 break;
57 default:
58 return NULL;
59 }
60
61 if (type != OBJ_COMMIT) {
62 if (!quiet)
63 error(_("object %s is a %s, not a %s"),
64 oid_to_hex(oid), type_name(type),
65 type_name(OBJ_COMMIT));
66 return NULL;
67 }
68
69 commit = lookup_commit(r, maybe_peeled);
70 if (!commit || repo_parse_commit_gently(r, commit, quiet) < 0)
71 return NULL;
72
73 return commit;
74}
75
76struct commit *lookup_commit_reference(struct repository *r, const struct object_id *oid)
77{

Callers 15

apply_ref_filterFunction · 0.85
parse_opt_merge_filterFunction · 0.85
keep_entryFunction · 0.85
is_unreachableFunction · 0.85
push_tip_to_listFunction · 0.85
reflog_expiry_prepareFunction · 0.85
dwim_reverse_initialFunction · 0.85
merge_commit_graphFunction · 0.85
parse_treeish_argFunction · 0.85
sequencer_pick_revisionsFunction · 0.85
add_to_tipsFunction · 0.85
add_missing_tagsFunction · 0.85

Calls 6

peel_object_extFunction · 0.85
errorFunction · 0.85
oid_to_hexFunction · 0.85
type_nameFunction · 0.85
lookup_commitFunction · 0.85
repo_parse_commit_gentlyFunction · 0.85

Tested by

no test coverage detected