Subject: [PATCH v3 0/3] Convert git-bisect--helper to OPT_SUBCOMMAND

From: Đoàn Trần Công Danh <[email-masked]>
Date: Thu, 10 Nov 2022 23:36:19 +0700

Despite this series has been merged into next.
I'm sending this because Taylor said he wanted a (combined) reroll?
<[email-masked]>

Change from v2 is only about cosmetic things, (structure zero-initialization)

This series aims to fix the problem that bisect--helper incorrectly consumes
"--log" when running:

	git bisect run cmd --log

This also clears a way for turning git-bisect into a built-in in a later day.

The series that convert git-bisect to builtin will be posted later as a reply
to this series

Đoàn Trần Công Danh (3):
  bisect--helper: remove unused options
  bisect--helper: move all subcommands into their own functions
  bisect--helper: parse subcommand with OPT_SUBCOMMAND

 builtin/bisect--helper.c    | 229 ++++++++++++++++++++----------------
 git-bisect.sh               |  23 +---
 t/t6030-bisect-porcelain.sh |  10 ++
 3 files changed, 142 insertions(+), 120 deletions(-)

Range-diff against v2:
-:  ---------- > 1:  6b80fd9398 bisect--helper: remove unused options
1:  9d8a3cdd7a ! 2:  248ed392ea bisect--helper: move all subcommands into their own functions
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +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 };
    ++	struct bisect_terms terms = { 0 };
     +
     +	if (argc > 1)
     +		return error(_("--bisect-terms requires 0 or 1 argument"));
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNUSED)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	set_terms(&terms, "bad", "good");
     +	res = bisect_start(&terms, argv, argc);
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *prefix)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	if (argc)
     +		return error(_("--bisect-next requires 0 arguments"));
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__state(int argc, const char **argv, const char *prefix UNUSED)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	set_terms(&terms, "bad", "good");
     +	get_terms(&terms);
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UNUSED)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	if (argc != 1)
     +		return error(_("no logfile given"));
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUSED)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	set_terms(&terms, "bad", "good");
     +	get_terms(&terms);
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix UNUSED)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	get_terms(&terms);
     +	res = bisect_visualize(&terms, argv, argc);
    @@ builtin/bisect--helper.c: static int bisect_run(struct bisect_terms *terms, cons
     +static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSED)
     +{
     +	int res;
    -+	struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
    ++	struct bisect_terms terms = { 0 };
     +
     +	if (!argc)
     +		return error(_("bisect run failed: no command provided."));
2:  a62ac72e24 = 3:  b67691f600 bisect--helper: parse subcommand with OPT_SUBCOMMAND
-- 
2.38.1.157.gedabe22e0a