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:
@@ -480,9 +480,16 @@ int cmd_tag(int argc,
|
||||
int edit_flag = 0;
|
||||
struct option options[] = {
|
||||
OPT_CMDMODE('l', "list", &cmdmode, N_("list tag names"), 'l'),
|
||||
{ OPTION_INTEGER, 'n', NULL, &filter.lines, N_("n"),
|
||||
N_("print <n> lines of each tag message"),
|
||||
PARSE_OPT_OPTARG, NULL, 1 },
|
||||
{
|
||||
.type = OPTION_INTEGER,
|
||||
.short_name = 'n',
|
||||
.value = &filter.lines,
|
||||
.precision = sizeof(filter.lines),
|
||||
.argh = N_("n"),
|
||||
.help = N_("print <n> lines of each tag message"),
|
||||
.flags = PARSE_OPT_OPTARG,
|
||||
.defval = 1,
|
||||
},
|
||||
OPT_CMDMODE('d', "delete", &cmdmode, N_("delete tags"), 'd'),
|
||||
OPT_CMDMODE('v', "verify", &cmdmode, N_("verify tags"), 'v'),
|
||||
|
||||
@@ -514,9 +521,14 @@ int cmd_tag(int argc,
|
||||
N_("do not output a newline after empty formatted refs")),
|
||||
OPT_REF_SORT(&sorting_options),
|
||||
{
|
||||
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
|
||||
N_("print only tags of the object"), PARSE_OPT_LASTARG_DEFAULT,
|
||||
parse_opt_object_name, (intptr_t) "HEAD"
|
||||
.type = OPTION_CALLBACK,
|
||||
.long_name = "points-at",
|
||||
.value = &filter.points_at,
|
||||
.argh = N_("object"),
|
||||
.help = N_("print only tags of the object"),
|
||||
.flags = PARSE_OPT_LASTARG_DEFAULT,
|
||||
.callback = parse_opt_object_name,
|
||||
.defval = (intptr_t) "HEAD",
|
||||
},
|
||||
OPT_STRING( 0 , "format", &format.format, N_("format"),
|
||||
N_("format to use for the output")),
|
||||
|
||||
Reference in New Issue
Block a user