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

fast-import: use the diff_delta() max_delta_size argument

This let diff_delta() abort early if it is going to bust the given size limit. Also, only objects larger than 20 bytes are considered as objects smaller than that are most certainly going to produce larger deltas than the original object due to the additional headers. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nicolas Pitre committed Feb 17, 2010 at 14:05 UTC b500d5e11ea67d29dd7be622f65571d611d6e9a3
1 file changed +2 -6
fast-import.c
+2 -6
@@ -1041,14 +1041,10 @@ static int store_object(
1041 return 1;
1042 }
1043
1044 - if (last && last->data.buf && last->depth < max_depth) {
1044 + if (last && last->data.buf && last->depth < max_depth && dat->len > 20) {
1045 delta = diff_delta(last->data.buf, last->data.len,
1046 dat->buf, dat->len,
1047 - &deltalen, 0);
1048 - if (delta && deltalen >= dat->len) {
1049 - free(delta);
1050 - delta = NULL;
1051 - }
1047 + &deltalen, dat->len - 20);
1048 } else
1049 delta = NULL;
1050