Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > contrib/completion/git-completion.bash | 2 +- > git.c | 2 ++ > help.c | 18 ++++++++++++++++++ > help.h | 1 + > 4 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index 3556838759..a5f13ade20 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -839,7 +839,7 @@ __git_commands () { > then > printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" > else > - git help -a|egrep '^ [a-zA-Z0-9]' > + git --list-cmds=all > fi > } To those of us who install a copy of git-completion.bash somewhere in $HOME and forget about it, while installing different versions of Git all the time for testing, may see breakage caused by an invalid combination of having new completion script with Git that does not know about --list=cmds=<all> option. I do not think it matters too much, though ;-) > +void list_all_cmds(void) > +{ > + struct cmdnames main_cmds, other_cmds; > + int i; > + > + memset(&main_cmds, 0, sizeof(main_cmds)); > + memset(&other_cmds, 0, sizeof(other_cmds)); > + load_command_list("git-", &main_cmds, &other_cmds); > + > + for (i = 0; i < main_cmds.cnt; i++) > + puts(main_cmds.names[i]->name); > + for (i = 0; i < other_cmds.cnt; i++) > + puts(other_cmds.names[i]->name); > + > + clean_cmdnames(&main_cmds); > + clean_cmdnames(&other_cmds); > +} > + OK. By reusing load_command_list(), the duplicate-removal logic at its end that is used for "help -a" kicks in; the above looks good.