Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > That's going to be super rare (and probably nonexisting) edge case, but > (untested) I wonder if something like this on top would alleviate your > concerns, i.e. instead of dying we just take the first N packs up to our > limit: > > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c > index 4406af640f..49d467ab2a 100644 > --- a/builtin/pack-objects.c > +++ b/builtin/pack-objects.c > @@ -1065,8 +1065,9 @@ static int want_object_in_pack(const struct object_id *oid, > > want = 1; > done: > - if (want && *found_pack && !(*found_pack)->index) > - oe_add_pack(&to_pack, *found_pack); > + if (want && *found_pack && !(*found_pack)->index) { > + if (oe_add_pack(&to_pack, *found_pack) == -1) > + return 0; > > return want; > } It is probably a small first step in the right direction, but we'd need to communicate which packs we ignored with this logic to the calling program. I offhand do not know how we would handle the "-d" part of "repack -a -d" without it.