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:
@@ -249,9 +249,16 @@ static struct option builtin_merge_options[] = {
|
||||
OPT_BOOL(0, "stat", &show_diffstat,
|
||||
N_("show a diffstat at the end of the merge")),
|
||||
OPT_BOOL(0, "summary", &show_diffstat, N_("(synonym to --stat)")),
|
||||
{ OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"),
|
||||
N_("add (at most <n>) entries from shortlog to merge commit message"),
|
||||
PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
|
||||
{
|
||||
.type = OPTION_INTEGER,
|
||||
.long_name = "log",
|
||||
.value = &shortlog_len,
|
||||
.precision = sizeof(shortlog_len),
|
||||
.argh = N_("n"),
|
||||
.help = N_("add (at most <n>) entries from shortlog to merge commit message"),
|
||||
.flags = PARSE_OPT_OPTARG,
|
||||
.defval = DEFAULT_MERGE_LOG_LEN,
|
||||
},
|
||||
OPT_BOOL(0, "squash", &squash,
|
||||
N_("create a single commit instead of doing a merge")),
|
||||
OPT_BOOL(0, "commit", &option_commit,
|
||||
@@ -273,9 +280,16 @@ static struct option builtin_merge_options[] = {
|
||||
OPT_CALLBACK('m', "message", &merge_msg, N_("message"),
|
||||
N_("merge commit message (for a non-fast-forward merge)"),
|
||||
option_parse_message),
|
||||
{ OPTION_LOWLEVEL_CALLBACK, 'F', "file", &merge_msg, N_("path"),
|
||||
N_("read message from file"), PARSE_OPT_NONEG,
|
||||
NULL, 0, option_read_message },
|
||||
{
|
||||
.type = OPTION_LOWLEVEL_CALLBACK,
|
||||
.short_name = 'F',
|
||||
.long_name = "file",
|
||||
.value = &merge_msg,
|
||||
.argh = N_("path"),
|
||||
.help = N_("read message from file"),
|
||||
.flags = PARSE_OPT_NONEG,
|
||||
.ll_callback = option_read_message,
|
||||
},
|
||||
OPT_STRING(0, "into-name", &into_name, N_("name"),
|
||||
N_("use <name> instead of the real target")),
|
||||
OPT__VERBOSITY(&verbosity),
|
||||
@@ -288,8 +302,16 @@ static struct option builtin_merge_options[] = {
|
||||
OPT_BOOL(0, "allow-unrelated-histories", &allow_unrelated_histories,
|
||||
N_("allow merging unrelated histories")),
|
||||
OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1),
|
||||
{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
|
||||
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
|
||||
{
|
||||
.type = OPTION_STRING,
|
||||
.short_name = 'S',
|
||||
.long_name = "gpg-sign",
|
||||
.value = &sign_commit,
|
||||
.argh = N_("key-id"),
|
||||
.help = N_("GPG sign commit"),
|
||||
.flags = PARSE_OPT_OPTARG,
|
||||
.defval = (intptr_t) "",
|
||||
},
|
||||
OPT_AUTOSTASH(&autostash),
|
||||
OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
|
||||
OPT_BOOL(0, "signoff", &signoff, N_("add a Signed-off-by trailer")),
|
||||
|
||||
Reference in New Issue
Block a user