Skip to content

Commit b500d5e

Browse files
npitregitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8c2ca8d commit b500d5e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

fast-import.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,14 +1041,10 @@ static int store_object(
10411041
return 1;
10421042
}
10431043

1044-
if (last && last->data.buf && last->depth < max_depth) {
1044+
if (last && last->data.buf && last->depth < max_depth && dat->len > 20) {
10451045
delta = diff_delta(last->data.buf, last->data.len,
10461046
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);
10521048
} else
10531049
delta = NULL;
10541050

0 commit comments

Comments
 (0)