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