Nguyễn Thái Ngọc Duy <[email protected]> writes:
> This allows us to select any group of commands by a category defined
> in command-list.txt. This is an internal/hidden option so we don't
> have to be picky about the category name or worried about exposing too
> much.
>
> This will be used later by git-completion.bash to retrieve certain
> command groups.
> ---
Missing sign-off.
>
> diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
> index 015eef2804..bfd8ef0671 100755
> --- a/generate-cmdlist.sh
> +++ b/generate-cmdlist.sh
> @@ -45,6 +45,21 @@ define_categories() {
> test "$bit" -gt 32 && die "Urgh.. too many categories?"
> }
>
> +define_category_names() {
Style.
> print_command_list() {
Ditto (but needs fixing in an earlier step).
> diff --git a/git.c b/git.c
> index 3c032d01fc..67f3e20ae9 100644
> --- a/git.c
> +++ b/git.c
> @@ -53,6 +53,13 @@ static int list_cmds(const char *spec)
> list_all_main_cmds(&list);
> else if (len == 6 && !strncmp(spec, "others", 6))
> list_all_other_cmds(&list);
> + else if (len > 5 && !strncmp(spec, "list-", 5)) {
Earlier I asked to have a small helper to avoid the constant length that
has to go together with a constant string, e.g.
has_prefix(spec, len, "others")
but this new one may make it a bit tricky.
else if (has_prefix(spec, len, "others")
...
else if (has_prefix(spec, len, "list-") &&
spec[strlen("list-")] != '\0' ) {
...
does look a bit ugly. Others may be able to help with better ideas.
Thansk.