Skip to content

Commit a588d88

Browse files
Martin KoeglerJunio C Hamano
authored andcommitted
builtin-pack-objects: don't fail, if delta is not possible
If builtin-pack-objects runs out of memory while finding the best deltas, it bails out with an error. If the delta index creation fails (because there is not enough memory), we can downgrade the error message to a warning and continue with the next object. Signed-off-by: Martin Koegler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 322bcd9 commit a588d88

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

builtin-pack-objects.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,8 +1454,12 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
14541454
}
14551455
if (!src->index) {
14561456
src->index = create_delta_index(src->data, src_size);
1457-
if (!src->index)
1458-
die("out of memory");
1457+
if (!src->index) {
1458+
static int warned = 0;
1459+
if (!warned++)
1460+
warning("suboptimal pack - out of memory");
1461+
return 0;
1462+
}
14591463
}
14601464

14611465
delta_buf = create_delta(src->index, trg->data, trg_size, &delta_size, max_size);

0 commit comments

Comments
 (0)