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

Function do_lookup_replace_object

replace-object.c:66–83  ·  view source on GitHub ↗

* If a replacement for object oid has been set up, return the * replacement object's name (replaced recursively, if necessary). * The return value is either oid or a pointer to a * permanently-allocated value. This function always respects replace * references, regardless of the value of r->settings.read_replace_refs. */

Source from the content-addressed store, hash-verified

64 * references, regardless of the value of r->settings.read_replace_refs.
65 */
66const struct object_id *do_lookup_replace_object(struct repository *r,
67 const struct object_id *oid)
68{
69 int depth = MAXREPLACEDEPTH;
70 const struct object_id *cur = oid;
71
72 prepare_replace_object(r);
73
74 /* Try to recursively replace the object */
75 while (depth-- > 0) {
76 struct replace_object *repl_obj =
77 oidmap_get(&r->objects->replace_map, cur);
78 if (!repl_obj)
79 return cur;
80 cur = &repl_obj->replacement;
81 }
82 die(_("replace depth too high for object %s"), oid_to_hex(oid));
83}
84
85/*
86 * This indicator determines whether replace references should be

Callers 1

lookup_replace_objectFunction · 0.85

Calls 4

prepare_replace_objectFunction · 0.85
oidmap_getFunction · 0.85
oid_to_hexFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected