diff options
author | René Scharfe <l.s.r@web.de> | 2024-01-21 18:56:39 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-22 07:17:12 -0800 |
commit | 457f96252fcfd64127f71e8663e2e4b6dfd4576c (patch) | |
tree | 4a1d41ec37d7cf146778f030a6c52c88e9ad4014 /t/unit-tests/t-basic.c | |
parent | 5825268db1058516d05be03d6a8d8d55eea5a943 (diff) |
parse-options: simplify positivation handling
We accept the positive version of options whose long name starts with
"no-" and are defined without the flag PARSE_OPT_NONEG. E.g. git clone
has an explicitly defined --no-checkout option and also implicitly
accepts --checkout to override it.
parse_long_opt() handles that by restarting the option matching with the
positive version when it finds that only the current option definition
starts with "no-", but not the user-supplied argument. This code is
located almost at the end of the matching logic.
Avoid the need for a restart by moving the code up. We don't have to
check the positive arg against the negative long_name at all -- the
"no-" prefix of the latter makes a match impossible. Skip it and toggle
OPT_UNSET right away to simplify the control flow.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/t-basic.c')
0 files changed, 0 insertions, 0 deletions