Re: [PATCH v3 4/6] git.c: implement --list-cmds=porcelain
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Apr 25, 2018, 13:06 UTC
- Message-ID
- <CAM0VKjmZeVF6GV9ZRXLdwZJJyFi8oLnGvKe7tQYi_QRLoAk4Og@mail.gmail.com>
- In-Reply-To
- <20180421165414.30051-5-pclouds@gmail.com>
On Sat, Apr 21, 2018 at 6:54 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 5 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index a5f13ade20..7d17ca23f6 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -835,18 +835,23 @@ __git_complete_strategy ()
> +__git_list_commands ()
Please add a comment before this function to mention its mandatory argument and that is should correspond to a category in 'command-list.txt'
> -__git_list_all_commands ()
> -__git_list_porcelain_commands ()
Users can have their own completion scriptlets for their own git commands, and these should be able to rely on helper functions in git-completion.bash to do things like refs completion and what not. Therefore, we tend not to remove or alter those helper functions in a backwards incompatible way, because we don't want to break those completion scriptlets.
Your patch removes these two functions. At first I let it slide, because first I thought that anyone who needs the list of all git commands is better off calling __git_compute_all_commands() and then using $__git_all_commands (same goes for porcelains), because it involves less fork()ed subshells and external processes. Then I thought why would anyone possibly need the list of git commands in a custom completion scriptlet in the first place... what for?!
Well, it turns out that there is at least one completion script out there that does rely on __git_list_all_commands() [1].
Please keep these two functions as a thin wrapper around __git_list_commands().
[1] And in a rather curious way at that:
https://github.com/github/hub/blob/master/etc/hub.bash_completion.sh#L12