Subject: Re: [PATCH 01/20] git.c: update NO_PARSEOPT markings

From: SZEDER Gábor <[email-masked]>
Date: Tue, 26 Jul 2022 21:55:16 +0200

On Mon, Jul 25, 2022 at 02:38:38PM +0200, SZEDER Gábor wrote:
> Our Bash completion script can complete --options for commands using
> parse-options even when that command doesn't have a dedicated
> completion function, but to do so the completion script must know
> which commands use parse-options and which don't.  Therefore, commands
> not using parse-options are marked in 'git.c's command list with the
> NO_PARSEOPT flag.
> 
> Update this list, and remove this flag from the commands that by now
> use parse-options.
> 
> Signed-off-by: SZEDER Gábor <[email-masked]>
> ---
>  git.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/git.c b/git.c
> index e5d62fa5a9..c4282f194a 100644
> --- a/git.c
> +++ b/git.c

> @@ -627,7 +627,7 @@ static struct cmd_struct commands[] = {
>  	{ "verify-tag", cmd_verify_tag, RUN_SETUP },
>  	{ "version", cmd_version },
>  	{ "whatchanged", cmd_whatchanged, RUN_SETUP },
> -	{ "worktree", cmd_worktree, RUN_SETUP | NO_PARSEOPT },
> +	{ "worktree", cmd_worktree, RUN_SETUP },

This hunk is wrong, 'worktree' does not use parse_options().  I was
fooled by seeing its (empty) 'struct option' array, thinking that then
it must surely use parse_options(), but it only uses that options
array to pass it to usage_with_options().

This NO_PARSEOPT flag should be removed in the last patch of the
series, when I convert cmd_worktree() to handle its subcommands with
parse_options().

>  	{ "write-tree", cmd_write_tree, RUN_SETUP },
>  };
>  
> -- 
> 2.37.1.633.g6a0fa73e39
>