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>
			
			
				maint
			
			
		
							parent
							
								
									af4e5f569b
								
							
						
					
					
						commit
						80c2e9657f
					
				|  | @ -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; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 René Scharfe
						René Scharfe