summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2018-06-30 21:41:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-06 16:46:12 (GMT)
commit9d14ecf39dc70cd2d2cf639d873b8e2c7f039d11 (patch)
treef3375968de6fbe5a439f73214767da69bccc77f4 /fast-import.c
parente3331758f12da22f4103eec7efe1b5304a9be5e9 (diff)
downloadgit-9d14ecf39dc70cd2d2cf639d873b8e2c7f039d11.zip
git-9d14ecf39dc70cd2d2cf639d873b8e2c7f039d11.tar.gz
git-9d14ecf39dc70cd2d2cf639d873b8e2c7f039d11.tar.bz2
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>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fast-import.c b/fast-import.c
index 4d55910..12195d5 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]++;