]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/config: stop printing full usage on misuse
authorPatrick Steinhardt <ps@pks.im>
Wed, 15 May 2024 06:41:38 +0000 (08:41 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 May 2024 14:17:51 +0000 (07:17 -0700)
commita577d2f1a93ecfafbedd5a30cc15e4180253f04d
tree1445ef6bae4940eaa2e2a853d4dacc85acb2346d
parent9422e7169ef21ddccc726bd02e973c97ac994b09
builtin/config: stop printing full usage on misuse

When invoking git-config(1) with a wrong set of arguments we end up
calling `usage_builtin_config()` after printing an error message that
says what was wrong. As that function ends up printing the full list of
options, which is quite long, the actual error message will be buried by
a wall of text. This makes it really hard to figure out what exactly
caused the error.

Furthermore, now that we have recently introduced subcommands, the usage
information may actually be misleading as we unconditionally print
options of the subcommand-less mode.

Fix both of these issues by just not printing the options at all
anymore. Instead, we call `usage()` that makes us report in a single
line what has gone wrong. This should be way more discoverable for our
users and addresses the inconsistency.

Furthermore, this change allow us to inline the options into the
respective functions that use them to parse the command line.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/config.c
t/t1300-config.sh