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

Function add_preferred_base

builtin/pack-objects.c:2126–2157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2124}
2125
2126static void add_preferred_base(struct object_id *oid)
2127{
2128 struct pbase_tree *it;
2129 void *data;
2130 unsigned long size;
2131 size_t size_st = 0;
2132 struct object_id tree_oid;
2133
2134 if (window <= num_preferred_base++)
2135 return;
2136
2137 data = odb_read_object_peeled(the_repository->objects, oid,
2138 OBJ_TREE, &size_st, &tree_oid);
2139 size = cast_size_t_to_ulong(size_st);
2140 if (!data)
2141 return;
2142
2143 for (it = pbase_tree; it; it = it->next) {
2144 if (oideq(&it->pcache.oid, &tree_oid)) {
2145 free(data);
2146 return;
2147 }
2148 }
2149
2150 CALLOC_ARRAY(it, 1);
2151 it->next = pbase_tree;
2152 pbase_tree = it;
2153
2154 oidcpy(&it->pcache.oid, &tree_oid);
2155 it->pcache.tree_data = data;
2156 it->pcache.tree_size = size;
2157}
2158
2159static void cleanup_preferred_base(void)
2160{

Callers 2

show_edgeFunction · 0.85

Calls 4

odb_read_object_peeledFunction · 0.85
cast_size_t_to_ulongFunction · 0.85
oideqFunction · 0.85
oidcpyFunction · 0.85

Tested by

no test coverage detected