aboutsummaryrefslogtreecommitdiff
path: root/builtin/bisect--helper.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-01-18 13:45:57 +0100
committerJunio C Hamano <gitster@pobox.com>2022-01-18 17:11:22 -0800
commit80c2e9657f2d0f0cd45eec6f5e66f570bf542124 (patch)
treed270d378502070072ff363e2c074f4e543d1954f /builtin/bisect--helper.c
parentaf4e5f569bc89f356eb34a9373d7f82aca6faa8a (diff)
downloadgit-80c2e9657f2d0f0cd45eec6f5e66f570bf542124.tar.xz
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 <r@artagnon.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/bisect--helper.c')
-rw-r--r--builtin/bisect--helper.c6
1 files changed, 1 insertions, 5 deletions
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;
}