]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/repack.c
builtin/repack.c: parse `--max-pack-size` with OPT_MAGNITUDE
authorTaylor Blau <me@ttaylorr.com>
Tue, 3 Oct 2023 00:44:29 +0000 (20:44 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Oct 2023 20:18:54 +0000 (13:18 -0700)
commitb5b1f4c0ecf20c069d0301732edfdbfec167aa0c
tree20c0d71834927e82d135f4351acc47be7c81f95f
parent78de1c6c327b00ec9ed97c478e5f9e56d03c1db8
builtin/repack.c: parse `--max-pack-size` with OPT_MAGNITUDE

The repack builtin takes a `--max-pack-size` command-line argument which
it uses to feed into any of the pack-objects children that it may spawn
when generating a new pack.

This option is parsed with OPT_STRING, meaning that we'll accept
anything as input, punting on more fine-grained validation until we get
down into pack-objects.

This is fine, but it's wasteful to spend an entire sub-process just to
figure out that one of its option is bogus. Instead, parse the value of
`--max-pack-size` with OPT_MAGNITUDE in 'git repack', and then pass the
known-good result down to pack-objects.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c