diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-01-27 01:35:25 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-28 01:28:18 +0100 |
commit | f62470c650e0db9536f32b9e1ecbe7d25f759031 (patch) | |
tree | a2173e2a99bc2deec3126be06a440b0071bd9d96 /parse-options.c | |
parent | parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN (diff) | |
download | git-f62470c650e0db9536f32b9e1ecbe7d25f759031.tar.xz git-f62470c650e0db9536f32b9e1ecbe7d25f759031.zip |
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>
Diffstat (limited to 'parse-options.c')
-rw-r--r-- | parse-options.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c index 779034e1fd..62d94ca2e0 100644 --- a/parse-options.c +++ b/parse-options.c @@ -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; |