From: René Scharfe Date: Tue, 18 Jan 2022 12:45:57 +0000 (+0100) Subject: bisect--helper: report actual bisect_state() argument on error X-Git-Tag: v2.36.0-rc0~99^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=80c2e9657f2d0f0cd45eec6f5e66f570bf542124;p=thirdparty%2Fgit.git bisect--helper: report actual bisect_state() argument on error The strvec "args" in bisect_run() is initialized and cleared, but never added to. Nevertheless its first member is printed when reporting a bisect_state() error. That's not useful, since it's always NULL. Before d1bbbe45df (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13) the intended new state was reported if it could not be set. Reinstate that behavior and remove the unused strvec. Reported-by: Ramkumar Ramachandra Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 28a2e6a575..1dbc6294ef 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1093,7 +1093,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) { int res = BISECT_OK; struct strbuf command = STRBUF_INIT; - struct strvec args = STRVEC_INIT; struct strvec run_args = STRVEC_INIT; const char *new_state; int temporary_stdout_fd, saved_stdout; @@ -1111,8 +1110,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) strvec_push(&run_args, command.buf); while (1) { - strvec_clear(&args); - printf(_("running %s\n"), command.buf); res = run_command_v_opt(run_args.v, RUN_USING_SHELL); @@ -1158,13 +1155,12 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) res = BISECT_OK; } else if (res) { error(_("bisect run failed: 'git bisect--helper --bisect-state" - " %s' exited with error code %d"), args.v[0], res); + " %s' exited with error code %d"), new_state, res); } else { continue; } strbuf_release(&command); - strvec_clear(&args); strvec_clear(&run_args); return res; }