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>
René Scharfe committed
Jan 18, 2022 at 13:45 UTC
80c2e9657f2d0f0cd45eec6f5e66f570bf542124
1 file changed
+1
-5
builtin/bisect--helper.c
+1
-5
@@ -1093,7 +1093,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1093
{
1094
int res = BISECT_OK;
1095
struct strbuf command = STRBUF_INIT;
1096
- struct strvec args = STRVEC_INIT;
1096
struct strvec run_args = STRVEC_INIT;
1097
const char *new_state;
1098
int temporary_stdout_fd, saved_stdout;
@@ -1111,8 +1110,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1110
strvec_push(&run_args, command.buf);
1111
1112
while (1) {
1114
- strvec_clear(&args);
1115
-
1113
printf(_("running %s\n"), command.buf);
1114
res = run_command_v_opt(run_args.v, RUN_USING_SHELL);
1115
@@ -1158,13 +1155,12 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1155
res = BISECT_OK;
1156
} else if (res) {
1157
error(_("bisect run failed: 'git bisect--helper --bisect-state"
1161
- " %s' exited with error code %d"), args.v[0], res);
1158
+ " %s' exited with error code %d"), new_state, res);
1159
} else {
1160
continue;
1161
}
1162
1163
strbuf_release(&command);
1167
- strvec_clear(&args);
1164
strvec_clear(&run_args);
1165
return res;
1166
}