bisect: let bisect_reset() optionally check out quietly
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Harald Nordgren committed
Aug 2, 2026 at 21:24 UTC
2e59acb77df349c5aaf06b4194fbbbcf0556d3ba
1 file changed
+7
-5
builtin/bisect.c
+7
-5
@@ -234,7 +234,7 @@ static int write_terms(const char *bad, const char *good)
234
return res;
235
}
236
237
-static int bisect_reset(const char *commit)
237
+static int bisect_reset(const char *commit, bool quiet)
238
{
239
struct strbuf branch = STRBUF_INIT;
240
@@ -255,8 +255,10 @@ static int bisect_reset(const char *commit)
255
struct child_process cmd = CHILD_PROCESS_INIT;
256
257
cmd.git_cmd = 1;
258
- strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees",
259
- branch.buf, "--", NULL);
258
+ strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees", NULL);
259
+ if (quiet)
260
+ strvec_push(&cmd.args, "--quiet");
261
+ strvec_pushl(&cmd.args, branch.buf, "--", NULL);
262
if (run_command(&cmd)) {
263
error(_("could not check out original"
264
" HEAD '%s'. Try 'git bisect"
@@ -1089,7 +1091,7 @@ static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *f
1091
if (is_empty_or_missing_file(filename))
1092
return error(_("cannot read file '%s' for replaying"), filename);
1093
1092
- if (bisect_reset(NULL))
1094
+ if (bisect_reset(NULL, false))
1095
return BISECT_FAILED;
1096
1097
fp = fopen(filename, "r");
@@ -1338,7 +1340,7 @@ static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNU
1340
if (argc > 1)
1341
return error(_("'%s' requires either no argument or a commit"),
1342
"git bisect reset");
1341
- return bisect_reset(argc ? argv[0] : NULL);
1343
+ return bisect_reset(argc ? argv[0] : NULL, false);
1344
}
1345
1346
static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED,