@matheusbsbs / matheus-bagliano / commits / b76f6b6278
Fork 0

pack-objects: allow "thin" packs to exceed depth limits

When creating a new pack to be used in .git/objects/pack/ directory, we carefully count the depth of deltified objects to be reused, so that the generated pack does not to exceed the specified depth limit for runtime efficiency. However, when we are generating a thin pack that does not contain base objects, such a pack can only be used during network transfer that is expanded on the other end upon reception, so being careful and artificially cutting the delta chain does not buy us anything except increased bandwidth requirement. This patch disables the delta chain depth limit check when reusing an existing delta. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 23, 2006 at 23:04 UTC b76f6b627802d0a3c8bbf66fba0c090dbe56d509
1 file changed +17 -4
pack-objects.c
+17 -4
@@ -663,10 +663,23 @@ static void get_object_details(void)
663 prepare_pack_ix();
664 for (i = 0, entry = objects; i < nr_objects; i++, entry++)
665 check_object(entry);
666 - for (i = 0, entry = objects; i < nr_objects; i++, entry++)
667 - if (!entry->delta && entry->delta_child)
668 - entry->delta_limit =
669 - check_delta_limit(entry, 1);
666 +
667 + if (nr_objects == nr_result) {
668 + /*
669 + * Depth of objects that depend on the entry -- this
670 + * is subtracted from depth-max to break too deep
671 + * delta chain because of delta data reusing.
672 + * However, we loosen this restriction when we know we
673 + * are creating a thin pack -- it will have to be
674 + * expanded on the other end anyway, so do not
675 + * artificially cut the delta chain and let it go as
676 + * deep as it wants.
677 + */
678 + for (i = 0, entry = objects; i < nr_objects; i++, entry++)
679 + if (!entry->delta && entry->delta_child)
680 + entry->delta_limit =
681 + check_delta_limit(entry, 1);
682 + }
683 }
684
685 typedef int (*entry_sort_t)(const struct object_entry *, const struct object_entry *);