Skip to content

Commit 80c2e96

Browse files
rscharfegitster
authored andcommitted
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 d1bbbe4 (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 <[email protected]> Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af4e5f5 commit 80c2e96

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

builtin/bisect--helper.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
10931093
{
10941094
int res = BISECT_OK;
10951095
struct strbuf command = STRBUF_INIT;
1096-
struct strvec args = STRVEC_INIT;
10971096
struct strvec run_args = STRVEC_INIT;
10981097
const char *new_state;
10991098
int temporary_stdout_fd, saved_stdout;
@@ -1111,8 +1110,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
11111110
strvec_push(&run_args, command.buf);
11121111

11131112
while (1) {
1114-
strvec_clear(&args);
1115-
11161113
printf(_("running %s\n"), command.buf);
11171114
res = run_command_v_opt(run_args.v, RUN_USING_SHELL);
11181115

@@ -1158,13 +1155,12 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
11581155
res = BISECT_OK;
11591156
} else if (res) {
11601157
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);
11621159
} else {
11631160
continue;
11641161
}
11651162

11661163
strbuf_release(&command);
1167-
strvec_clear(&args);
11681164
strvec_clear(&run_args);
11691165
return res;
11701166
}

0 commit comments

Comments
 (0)