Subject: Re: [PATCH v2 2/3] bisect--helper: move all subcommands into their own functions

From: Đoàn Trần Công Danh <[email-masked]>
Date: Sun, 6 Nov 2022 00:13:28 +0700

On 2022-11-06 00:03:35+0700, Đoàn Trần Công Danh <[email-masked]> wrote:
> In a later change, we will use OPT_SUBCOMMAND to parse sub-commands to
> avoid consuming non-option opts.
> 
> Since OPT_SUBCOMMAND needs a function pointer to operate,
> let's move it now.
> 
> Signed-off-by: Đoàn Trần Công Danh <[email-masked]>
> ---
>  builtin/bisect--helper.c | 155 ++++++++++++++++++++++++++++++---------
>  1 file changed, 121 insertions(+), 34 deletions(-)
> 
> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
> index 5ec2e67f59..292c6fd1dd 100644
> --- a/builtin/bisect--helper.c
> +++ b/builtin/bisect--helper.c
> @@ -1279,6 +1279,117 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
>  	return res;
>  }
>  
> +static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED)
> +{
> +	if (argc > 1)
> +		return error(_("--bisect-reset requires either no argument or a commit"));
> +	return bisect_reset(argc ? argv[0] : NULL);
> +}
> +
> +static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED)
> +{
> +	int res;
> +	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };

Note to self: I need to change this to

	struct bisect_terms terms = { 0 };

in the next revisions.

-- 
Danh