diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-08-14 13:26:40 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-08-14 13:26:40 -0700 |
| commit | aea6c0531cc97af2054455dcf4f39bd904dafb50 (patch) | |
| tree | e685187e5e75079986a52e20ba2f33dc2188e5dc | |
| parent | f12cb5052d83f5477f7311ccf00b4249dc6d500b (diff) | |
| parent | 3284b93862b0aaea9d8e708f0aabd53e3e94409e (diff) | |
| download | git-aea6c0531cc97af2054455dcf4f39bd904dafb50.tar.gz | |
Merge branch 'rs/parse-opt-forbid-set-int-0-without-noneg'
Developer support to detect meaningless combination of options.
* rs/parse-opt-forbid-set-int-0-without-noneg:
parse-options: disallow negating OPTION_SET_INT 0
| -rw-r--r-- | parse-options.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c index 87c9fae634..60224cf8d0 100644 --- a/parse-options.c +++ b/parse-options.c @@ -480,6 +480,9 @@ static void parse_options_check(const struct option *opts) opts->long_name)) optbug(opts, "uses feature " "not supported for dashless options"); + if (opts->type == OPTION_SET_INT && !opts->defval && + opts->long_name && !(opts->flags & PARSE_OPT_NONEG)) + optbug(opts, "OPTION_SET_INT 0 should not be negatable"); switch (opts->type) { case OPTION_COUNTUP: case OPTION_BIT: |
