parse-options: show negatability of options in short help
commite8e5d294dc6e3b6b32132cc8018d01ce35ad0af0
authorRené Scharfe <l.s.r@web.de>
Sat, 5 Aug 2023 14:40:59 +0000 (5 16:40 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Aug 2023 00:16:50 +0000 (6 17:16 -0700)
tree0322d505e3563a0a775822be930b66d26ccc8c8c
parentd5dc68f73041f95c1179fb092005e2326bdd8a7b
parse-options: show negatability of options in short help

Add a "[no-]" prefix to options without the flag PARSE_OPT_NONEG to
document the fact that you can negate them.

This looks a bit strange for options that already start with "no-", e.g.
for the option --no-name of git show-branch:

    --[no-]no-name        suppress naming strings

You can actually use --no-no-name as an alias of --name, so the short
help is not wrong.  If we strip off any of the "no-"s, we lose either
the ability to see if the remaining one belongs to the documented
variant or to see if it can be negated.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-rev-parse.txt
contrib/subtree/t/t7900-subtree.sh
parse-options.c
t/t0040-parse-options.sh
t/t1502-rev-parse-parseopt.sh
t/t1502/optionspec-neg.help
t/t1502/optionspec.help