]> git.ipfire.org Git - thirdparty/git.git/blobdiff - help.c
Merge branch 'jh/midx-verify-too-many-packs'
[thirdparty/git.git] / help.c
diff --git a/help.c b/help.c
index ff05fd22dff064f0f872434d20d4ea1eacded07d..a9e451f2ee7a165eecb17746db9cc1a2f7e2cfbb 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));
                }
        }
@@ -374,13 +375,6 @@ void list_cmds_by_config(struct string_list *list)
 {
        const char *cmd_list;
 
-       /*
-        * There's no actual repository setup at this point (and even
-        * if there is, we don't really care; only global config
-        * matters). If we accidentally set up a repository, it's ok
-        * too since the caller (git --list-cmds=) should exit shortly
-        * anyway.
-        */
        if (git_config_get_string_const("completion.commands", &cmd_list))
                return;
 
@@ -392,8 +386,8 @@ void list_cmds_by_config(struct string_list *list)
                const char *p = strchrnul(cmd_list, ' ');
 
                strbuf_add(&sb, cmd_list, p - cmd_list);
-               if (*cmd_list == '-')
-                       string_list_remove(list, cmd_list + 1, 0);
+               if (sb.buf[0] == '-')
+                       string_list_remove(list, sb.buf + 1, 0);
                else
                        string_list_insert(list, sb.buf);
                strbuf_release(&sb);