Merge branch 'nd/help-align-command-desc'
authorJunio C Hamano <gitster@pobox.com>
Thu, 7 Feb 2019 06:05:27 +0000 (22:05 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Feb 2019 06:05:27 +0000 (22:05 -0800)
Output from "git help" was not correctly aligned, which has been
fixed.

* nd/help-align-command-desc:
help: align the longest command in the command listing

help.c
diff --git a/help.c b/help.c
index ff05fd22dff064f0f872434d20d4ea1eacded07d..520c9080e8e4abf7793af0966588aa370f09d316 100644 (file)
--- a/help.c
+++ b/help.c
@@ -85,7 +85,8 @@ static void print_command_list(const struct cmdname_help *cmds,
                if (cmds[i].category & mask) {
                        size_t len = strlen(cmds[i].name);
                        printf("   %s   ", cmds[i].name);
-                       mput_char(' ', longest > len ? longest - len : 1);
+                       if (longest > len)
+                               mput_char(' ', longest - len);
                        puts(_(cmds[i].help));
                }
        }