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

Function midx_oid_compare

midx-write.c:203–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201};
202
203static int midx_oid_compare(const void *_a, const void *_b)
204{
205 const struct pack_midx_entry *a = (const struct pack_midx_entry *)_a;
206 const struct pack_midx_entry *b = (const struct pack_midx_entry *)_b;
207 int cmp = oidcmp(&a->oid, &b->oid);
208
209 if (cmp)
210 return cmp;
211
212 /* Sort objects in a preferred pack first when multiple copies exist. */
213 if (a->preferred > b->preferred)
214 return -1;
215 if (a->preferred < b->preferred)
216 return 1;
217
218 if (a->pack_mtime > b->pack_mtime)
219 return -1;
220 else if (a->pack_mtime < b->pack_mtime)
221 return 1;
222
223 return a->pack_int_id - b->pack_int_id;
224}
225
226static int nth_midxed_pack_midx_entry(struct multi_pack_index *m,
227 struct pack_midx_entry *e,

Callers

nothing calls this directly

Calls 1

oidcmpFunction · 0.85

Tested by

no test coverage detected