]> git.ipfire.org Git - thirdparty/git.git/commit
parse-options: allow omitting option help text
authorRené Scharfe <l.s.r@web.de>
Sat, 26 Aug 2023 08:06:00 +0000 (10:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Aug 2023 15:20:20 +0000 (08:20 -0700)
commitcd52d9e90f63a1a08023980d27f3004174d23655
tree4ba145080817f3af3657bd893833d7ec12d79f68
parent6807fcfedab84bc8cd0fbf721bc13c4e68cda9ae
parse-options: allow omitting option help text

1b68387e02 (builtin/receive-pack.c: use parse_options API, 2016-03-02)
added the options --stateless-rpc, --advertise-refs and
--reject-thin-pack-for-testing with a NULL `help` string; 03831ef7b5
(difftool: implement the functionality in the builtin, 2017-01-19)
similarly added the "helpless" option --prompt.  Presumably this was
done because all four options are hidden and self-explanatory.

They cause a NULL pointer dereference when using the option --help-all
with their respective tool, though.  Handle such options gracefully
instead by turning the NULL pointer into an empty string at the top of
the loop, always printing a newline at the end and passing through the
separating newlines from the help text.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.c