summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-02-23 23:04:52 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-02-23 23:04:52 -0800
commitb76f6b627802d0a3c8bbf66fba0c090dbe56d509 (patch)
treeba4721411f1fe168be18f429fb511c9bd574af1b
parentpack-objects: use full pathname to help hashing with "thin" pack. (diff)
downloadtgif-b76f6b627802d0a3c8bbf66fba0c090dbe56d509.tar.xz
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>
-rw-r--r--pack-objects.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/pack-objects.c b/pack-objects.c
index 3a16b7e4ce..2320bcf310 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -663,10 +663,23 @@ static void get_object_details(void)
prepare_pack_ix();
for (i = 0, entry = objects; i < nr_objects; i++, entry++)
check_object(entry);
- for (i = 0, entry = objects; i < nr_objects; i++, entry++)
- if (!entry->delta && entry->delta_child)
- entry->delta_limit =
- check_delta_limit(entry, 1);
+
+ if (nr_objects == nr_result) {
+ /*
+ * Depth of objects that depend on the entry -- this
+ * is subtracted from depth-max to break too deep
+ * delta chain because of delta data reusing.
+ * However, we loosen this restriction when we know we
+ * are creating a thin pack -- it will have to be
+ * expanded on the other end anyway, so do not
+ * artificially cut the delta chain and let it go as
+ * deep as it wants.
+ */
+ for (i = 0, entry = objects; i < nr_objects; i++, entry++)
+ if (!entry->delta && entry->delta_child)
+ entry->delta_limit =
+ check_delta_limit(entry, 1);
+ }
}
typedef int (*entry_sort_t)(const struct object_entry *, const struct object_entry *);