fast-import: do not call diff_delta() with empty buffer

We know diff_delta() returns NULL, saying "no good delta exists for
it", when fed an empty data.  Check the length of the data in the
caller to avoid such a call.

This incidentally reduces the number of attempted deltification we
see in the final statistics.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Mike Hommey 2018-07-01 06:41:06 +09:00 committed by Junio C Hamano
parent e3331758f1
commit 9d14ecf39d

View file

@ -1076,7 +1076,7 @@ static int store_object(
return 1;
}
if (last && last->data.buf && last->depth < max_depth
if (last && last->data.len && last->data.buf && last->depth < max_depth
&& dat->len > the_hash_algo->rawsz) {
delta_count_attempts_by_type[type]++;