Thread (40 messages) flat view 40 messages, 4 authors, 2021-09-23
STALE1824d

Revision v1 of 3 in this series.

Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH 4/6] help: refactor "for_human" control flow in cmd_help()

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-09-08 15:24:38
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help