Merge branch 'cb/parse-magnitude'
Move machinery to parse human-readable scaled numbers like 1k, 4M, and 2G as an option parameter's value from pack-objects to parse-options API, to make it available to other codepaths. * cb/parse-magnitude: parse-options: move unsigned long option parsing out of pack-objects.c test-parse-options: update to handle negative ints
This commit is contained in:
@ -2588,23 +2588,6 @@ static int option_parse_unpack_unreachable(const struct option *opt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int option_parse_ulong(const struct option *opt,
|
||||
const char *arg, int unset)
|
||||
{
|
||||
if (unset)
|
||||
die(_("option %s does not accept negative form"),
|
||||
opt->long_name);
|
||||
|
||||
if (!git_parse_ulong(arg, opt->value))
|
||||
die(_("unable to parse value '%s' for option %s"),
|
||||
arg, opt->long_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OPT_ULONG(s, l, v, h) \
|
||||
{ OPTION_CALLBACK, (s), (l), (v), "n", (h), \
|
||||
PARSE_OPT_NONEG, option_parse_ulong }
|
||||
|
||||
int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
int use_internal_rev_list = 0;
|
||||
@ -2627,16 +2610,16 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
{ OPTION_CALLBACK, 0, "index-version", NULL, N_("version[,offset]"),
|
||||
N_("write the pack index file in the specified idx format version"),
|
||||
0, option_parse_index_version },
|
||||
OPT_ULONG(0, "max-pack-size", &pack_size_limit,
|
||||
N_("maximum size of each output pack file")),
|
||||
OPT_MAGNITUDE(0, "max-pack-size", &pack_size_limit,
|
||||
N_("maximum size of each output pack file")),
|
||||
OPT_BOOL(0, "local", &local,
|
||||
N_("ignore borrowed objects from alternate object store")),
|
||||
OPT_BOOL(0, "incremental", &incremental,
|
||||
N_("ignore packed objects")),
|
||||
OPT_INTEGER(0, "window", &window,
|
||||
N_("limit pack window by objects")),
|
||||
OPT_ULONG(0, "window-memory", &window_memory_limit,
|
||||
N_("limit pack window by memory in addition to object limit")),
|
||||
OPT_MAGNITUDE(0, "window-memory", &window_memory_limit,
|
||||
N_("limit pack window by memory in addition to object limit")),
|
||||
OPT_INTEGER(0, "depth", &depth,
|
||||
N_("maximum length of delta chain allowed in the resulting pack")),
|
||||
OPT_BOOL(0, "reuse-delta", &reuse_delta,
|
||||
|
Reference in New Issue
Block a user