parse-options: move unsigned long option parsing out of pack-objects.c
commit2a514ed8058e35841d3d7b05a898991b83e5eaf0
authorCharles Bailey <cbailey32@bloomberg.net>
Sun, 21 Jun 2015 18:25:44 +0000 (21 19:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jun 2015 22:07:21 +0000 (22 15:07 -0700)
treeeb121b83543970a0f21988d5f301743692e788b3
parent81a48cc08033a453bcb884ec0838a8f064a6611e
parse-options: move unsigned long option parsing out of pack-objects.c

The unsigned long option parsing (including 'k'/'m'/'g' suffix
parsing) is more widely applicable.  Add support for OPT_MAGNITUDE
to parse-options.h and change pack-objects.c use this support.

The error behavior on parse errors follows that of OPT_INTEGER.  The
name of the option that failed to parse is reported with a brief
message describing the expect format for the option argument and
then the full usage message for the command invoked.

This differs from the previous behavior for OPT_ULONG used in
pack-objects for --max-pack-size and --window-memory which used to
display the value supplied in the error message and did not display
the full usage message.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/technical/api-parse-options.txt
builtin/pack-objects.c
parse-options.c
parse-options.h
t/t0040-parse-options.sh
test-parse-options.c