@matheusbsbs / matheus-bagliano / commits / a588d88aaf
Fork 0

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 <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <junkio@cox.net>

Martin Koegler committed May 28, 2007 at 23:20 UTC a588d88aaff312f3afd5713ffcb4e4b1829fb5a6
1 file changed +6 -2
builtin-pack-objects.c
+6 -2
@@ -1454,8 +1454,12 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1454 }
1455 if (!src->index) {
1456 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 + }
1463 }
1464
1465 delta_buf = create_delta(src->index, trg->data, trg_size, &delta_size, max_size);