Re: [PATCH v4 1/2] bisect: let bisect_reset() optionally check out quietly
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 1, 2026, 19:15 UTC
- Message-ID
- <xmqqa4r58xem.fsf@gitster.g>
- In-Reply-To
- <e39670edf4be8bc917a985666f200a88880212ce.1785577445.git.gitgitgadget@gmail.com>
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 23 quoted lines
> From: Harald Nordgren <haraldnordgren@gmail.com> > > Add a "quiet" parameter to bisect_reset() that passes "--quiet" to the > checkout restoring the original HEAD, suppressing its progress and > branch-status output. > > No caller sets the flag yet, so behavior is unchanged. > > Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> > --- > builtin/bisect.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/builtin/bisect.c b/builtin/bisect.c > index 3264e2da54..1e0c043249 100644 > --- a/builtin/bisect.c > +++ b/builtin/bisect.c > @@ -234,7 +234,7 @@ static int write_terms(const char *bad, const char *good) > return res; > } > > -static int bisect_reset(const char *commit) > +static int bisect_reset(const char *commit, int quiet)
Not a huge deal but given that you are adding "bool defer_reset" in the next step, it may be more consistent to add this also as a bool?
Show 31 quoted lines
> @@ -255,8 +255,10 @@ static int bisect_reset(const char *commit)
> struct child_process cmd = CHILD_PROCESS_INIT;
>
> cmd.git_cmd = 1;
> - strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees",
> - branch.buf, "--", NULL);
> + strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees", NULL);
> + if (quiet)
> + strvec_push(&cmd.args, "--quiet");
> + strvec_pushl(&cmd.args, branch.buf, "--", NULL);
> if (run_command(&cmd)) {
> error(_("could not check out original"
> " HEAD '%s'. Try 'git bisect"
> @@ -1096,7 +1098,7 @@ static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *f
> if (is_empty_or_missing_file(filename))
> return error(_("cannot read file '%s' for replaying"), filename);
>
> - if (bisect_reset(NULL))
> + if (bisect_reset(NULL, 0))
> return BISECT_FAILED;
>
> fp = fopen(filename, "r");
> @@ -1345,7 +1347,7 @@ static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNU
> if (argc > 1)
> return error(_("'%s' requires either no argument or a commit"),
> "git bisect reset");
> - return bisect_reset(argc ? argv[0] : NULL);
> + return bisect_reset(argc ? argv[0] : NULL, 0);
> }
>
> static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED,