summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1ed8415)
raw | patch | inline | side by side (parent: 1ed8415)
author | Brian Downing <bdowning@lavos.net> | |
Mon, 9 Jul 2007 04:45:21 +0000 (23:45 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 9 Jul 2007 06:48:17 +0000 (23:48 -0700) |
Change "try_delta" so that if it finds a delta that has the same size
but shallower depth than the existing delta, it will prefer the
shallower one. This makes certain delta trees vastly less deep.
Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
but shallower depth than the existing delta, it will prefer the
shallower one. This makes certain delta trees vastly less deep.
Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 3d396ca37ac1356c7974aaaf34af39bcd0cf6bae..54b9d268da7d3b968f7a950dbe8bad9c2735e345 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
if (max_size == 0)
return 0;
if (trg_entry->delta && trg_entry->delta_size <= max_size)
- max_size = trg_entry->delta_size-1;
+ max_size = trg_entry->delta_size;
src_size = src_entry->size;
sizediff = src_size < trg_size ? trg_size - src_size : 0;
if (sizediff >= max_size)
return 0;
if (trg_entry->delta_data) {
+ /* Prefer only shallower same-sized deltas. */
+ if (delta_size == trg_entry->delta_size &&
+ src_entry->depth + 1 >= trg_entry->depth) {
+ free(delta_buf);
+ return 0;
+ }
delta_cache_size -= trg_entry->delta_size;
free(trg_entry->delta_data);
}