diff options
Diffstat (limited to 'help.c')
-rw-r--r-- | help.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -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); |