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

Function compute_write_order

builtin/pack-objects.c:987–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985}
986
987static struct object_entry **compute_write_order(void)
988{
989 uint32_t max_layers = 1;
990 unsigned int i, wo_end;
991
992 struct object_entry **wo;
993 struct object_entry *objects = to_pack.objects;
994
995 for (i = 0; i < to_pack.nr_objects; i++) {
996 objects[i].tagged = 0;
997 objects[i].filled = 0;
998 SET_DELTA_CHILD(&objects[i], NULL);
999 SET_DELTA_SIBLING(&objects[i], NULL);
1000 }
1001
1002 /*
1003 * Fully connect delta_child/delta_sibling network.
1004 * Make sure delta_sibling is sorted in the original
1005 * recency order.
1006 */
1007 for (i = to_pack.nr_objects; i > 0;) {
1008 struct object_entry *e = &objects[--i];
1009 if (!DELTA(e))
1010 continue;
1011 /* Mark me as the first child */
1012 e->delta_sibling_idx = DELTA(e)->delta_child_idx;
1013 SET_DELTA_CHILD(DELTA(e), e);
1014 }
1015
1016 /*
1017 * Mark objects that are at the tip of tags.
1018 */
1019 refs_for_each_tag_ref(get_main_ref_store(the_repository), mark_tagged,
1020 NULL);
1021
1022 if (use_delta_islands) {
1023 max_layers = compute_pack_layers(&to_pack);
1024 free_island_marks();
1025 }
1026
1027 ALLOC_ARRAY(wo, to_pack.nr_objects);
1028 wo_end = 0;
1029
1030 for (; write_layer < max_layers; ++write_layer)
1031 compute_layer_order(wo, &wo_end);
1032
1033 if (wo_end != to_pack.nr_objects)
1034 die(_("ordered %u objects, expected %"PRIu32),
1035 wo_end, to_pack.nr_objects);
1036
1037 return wo;
1038}
1039
1040
1041/*

Callers 1

write_pack_fileFunction · 0.85

Calls 6

refs_for_each_tag_refFunction · 0.85
get_main_ref_storeFunction · 0.85
compute_pack_layersFunction · 0.85
free_island_marksFunction · 0.85
compute_layer_orderFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected