Skip to content

Commit

Permalink
builtin-pack-objects: don't fail, if delta is not possible
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Martin Koegler authored and Junio C Hamano committed May 29, 2007
1 parent 322bcd9 commit a588d88
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,8 +1454,12 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
}
if (!src->index) {
src->index = create_delta_index(src->data, src_size);
if (!src->index)
die("out of memory");
if (!src->index) {
static int warned = 0;
if (!warned++)
warning("suboptimal pack - out of memory");
return 0;
}
}

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

0 comments on commit a588d88

Please sign in to comment.