parse-options: add OPT_BITOP()
This is needed for diff_opt_parse() where we do value = (value & ~mask) | some_more; Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
baa4adc66a
commit
f62470c650
@ -109,6 +109,13 @@ static int get_value(struct parse_opt_ctx_t *p,
|
||||
*(int *)opt->value &= ~opt->defval;
|
||||
return 0;
|
||||
|
||||
case OPTION_BITOP:
|
||||
if (unset)
|
||||
BUG("BITOP can't have unset form");
|
||||
*(int *)opt->value &= ~opt->extra;
|
||||
*(int *)opt->value |= opt->defval;
|
||||
return 0;
|
||||
|
||||
case OPTION_COUNTUP:
|
||||
if (*(int *)opt->value < 0)
|
||||
*(int *)opt->value = 0;
|
||||
|
||||
Reference in New Issue
Block a user