From 9d14ecf39dc70cd2d2cf639d873b8e2c7f039d11 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 1 Jul 2018 06:41:06 +0900 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- fast-import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast-import.c b/fast-import.c index 4d55910ab9..12195d54d7 100644 --- a/fast-import.c +++ b/fast-import.c @@ -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]++;