Merge branch 'ps/parse-options-integers'

Update parse-options API to catch mistakes to pass address of an
integral variable of a wrong type/size.

* ps/parse-options-integers:
  parse-options: detect mismatches in integer signedness
  parse-options: introduce precision handling for `OPTION_UNSIGNED`
  parse-options: introduce precision handling for `OPTION_INTEGER`
  parse-options: rename `OPT_MAGNITUDE()` to `OPT_UNSIGNED()`
  parse-options: support unit factors in `OPT_INTEGER()`
  global: use designated initializers for options
  parse: fix off-by-one for minimum signed values
This commit is contained in:
Junio C Hamano
2025-04-24 17:25:33 -07:00
37 changed files with 656 additions and 252 deletions

View File

@@ -132,8 +132,16 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
OPT_STRING(0, "strategy", &strategy, N_("strategy"), N_("merge strategy")),
OPT_STRVEC('X', "strategy-option", &opts->xopts, N_("option"),
N_("option for merge strategy")),
{ OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
{
.type = OPTION_STRING,
.short_name = 'S',
.long_name = "gpg-sign",
.value = &gpg_sign,
.argh = N_("key-id"),
.help = N_("GPG sign commit"),
.flags = PARSE_OPT_OPTARG,
.defval = (intptr_t) "",
},
OPT_END()
};
struct option *options = base_options;