[PATCH 4/6] help: refactor "for_human" control flow in cmd_help()
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Sep 8, 2021, 15:24 UTC
- Message-ID
- <patch-4.6-e4bc7e57a6d-20210908T151949Z-avarab@gmail.com>
- In-Reply-To
- <cover-0.6-00000000000-20210908T151949Z-avarab@gmail.com>
Instead of having two lines that call list_config_help(for_human) let's setup the pager and print the trailer conditionally. This makes it clearer at a glance how the two differ in behavior.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/help.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/builtin/help.c b/builtin/help.c index 0f9dc31c40f..0737b22069b 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -574,13 +574,12 @@ int cmd_help(int argc, const char **argv, const char *prefix) if (show_config) { int for_human = show_config == 1; - if (!for_human) { - list_config_help(for_human); - return 0; - } - setup_pager(); + if (for_human) + setup_pager(); list_config_help(for_human); - printf("\n%s\n", _("'git help config' for more information")); + if (for_human) + printf("\n%s\n", _("'git help config' for more information")); + return 0; }
-- 2.33.0.825.g2bf60429931