summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c
index 80106c0..3eceba4 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -180,6 +180,23 @@ static int get_value(struct parse_opt_ctx_t *p,
return opterror(opt, "expects a numerical value", flags);
return 0;
+ case OPTION_MAGNITUDE:
+ if (unset) {
+ *(unsigned long *)opt->value = 0;
+ return 0;
+ }
+ if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
+ *(unsigned long *)opt->value = opt->defval;
+ return 0;
+ }
+ if (get_arg(p, opt, flags, &arg))
+ return -1;
+ if (!git_parse_ulong(arg, opt->value))
+ return opterror(opt,
+ "expects a non-negative integer value with an optional k/m/g suffix",
+ flags);
+ return 0;
+
default:
die("should not happen, someone must be hit on the forehead");
}