diff options
author | Jeff King <peff@peff.net> | 2012-04-18 14:10:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-18 16:17:42 -0700 |
commit | 234587fc87b156dc20461fc61353beeb904b43bc (patch) | |
tree | 698f4806c37f7117e9cc2ef86c5fe35bd8e98c62 /tree.c | |
parent | argv-array: add a new "pushl" method (diff) | |
download | tgif-234587fc87b156dc20461fc61353beeb904b43bc.tar.xz |
gc: use argv-array for sub-commands
git-gc executes many sub-commands. The argument list for
some of these is constant, but for others we add more
arguments at runtime. The latter is implemented by allocating
a constant extra number of NULLs, and either using a custom
append function, or just referencing unused slots by number.
As of commit 7e52f56, which added two new arguments, it is
possible to exceed the constant number of slots for "repack"
by running "git gc --aggressive", causing "git gc" to die.
This patch converts all of the static argv lists to use
argv-array. In addition to fixing the overflow caused by
7e52f56, it has a few advantages:
1. We can drop the custom append function (which,
incidentally, had an off-by-one error exacerbating the
static limit).
2. We can drop the ugly magic numbers used when adding
arguments to "prune".
3. Adding further arguments will be easier; you can just
add new "push" calls without worrying about increasing
any static limits.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree.c')
0 files changed, 0 insertions, 0 deletions