diff options
author | Nicolas Pitre <nico@fluxnic.net> | 2010-02-17 14:05:56 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-17 11:08:44 -0800 |
commit | b500d5e11ea67d29dd7be622f65571d611d6e9a3 (patch) | |
tree | acd3a4b4885a6b697644bdf7a5bc100081d64ad9 | |
parent | fast-import: honor pack.indexversion and pack.packsizelimit config vars (diff) | |
download | tgif-b500d5e11ea67d29dd7be622f65571d611d6e9a3.tar.xz |
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>
-rw-r--r-- | fast-import.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fast-import.c b/fast-import.c index 7fc98620b2..74f08bd554 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1041,14 +1041,10 @@ static int store_object( return 1; } - if (last && last->data.buf && last->depth < max_depth) { + if (last && last->data.buf && last->depth < max_depth && dat->len > 20) { delta = diff_delta(last->data.buf, last->data.len, dat->buf, dat->len, - &deltalen, 0); - if (delta && deltalen >= dat->len) { - free(delta); - delta = NULL; - } + &deltalen, dat->len - 20); } else delta = NULL; |