X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-pack-objects.c;h=971388276a66090bb2bb12475e9e714b54bf4898;hb=290b1467a387a3e5306028f36118a52958fa36c5;hp=3824ee33acb2f984419ab79c2f3ecc306d3e5ea5;hpb=9299c4f147bcff603eef187eb04fe38153571d30;p=git.git diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 3824ee33a..971388276 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1551,9 +1551,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) int use_internal_rev_list = 0; int thin = 0; int i; - const char *rp_av[64]; + const char **rp_av; + int rp_ac_alloc = 64; int rp_ac; + rp_av = xcalloc(rp_ac_alloc, sizeof(*rp_av)); + rp_av[0] = "pack-objects"; rp_av[1] = "--objects"; /* --thin will make it --objects-edge */ rp_ac = 2; @@ -1626,8 +1629,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) !strcmp("--reflog", arg) || !strcmp("--all", arg)) { use_internal_rev_list = 1; - if (ARRAY_SIZE(rp_av) - 1 <= rp_ac) - die("too many internal rev-list options"); + if (rp_ac >= rp_ac_alloc - 1) { + rp_ac_alloc = alloc_nr(rp_ac_alloc); + rp_av = xrealloc(rp_av, + rp_ac_alloc * sizeof(*rp_av)); + } rp_av[rp_ac++] = arg; continue; }