git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] bisect: output bisect setup status in bisect log

From
Junio C Hamano <gitster@pobox.com>
Date
May 6, 2022, 18:18 UTC
Message-ID
<xmqqh762le32.fsf@gitster.g>
In-Reply-To
<acab8859d02c95750fdbc691ac672c17d5be0291.1651796862.git.chris@chrisdown.name>
Chris Down <chris@chrisdown.name> writes:
Show 10 quoted lines
> +__attribute__((format (printf, 1, 2)))
> +static void bisect_log_printf(const char *fmt, ...)
> +{
> +	va_list ap;
> +	char buf[1024];
> +
> +	va_start(ap, fmt);
> +	if (vsnprintf(buf, sizeof(buf), fmt, ap) < 0)
> +		*buf = '\0';
> +	va_end(ap);
We should just do
	struct strbuf buf = STRBUF_INIT;
	va_start(ap, fmt);
	strbuf_vaddf(&buf, fmt, ap);
	va_end(ap);
> +	printf("%s", buf);
> +	append_to_file(git_path_bisect_log(), "# %s", buf);
and free the resource with
	strbuf_release(&buf);
I think.
> +}
Show 9 quoted lines
> diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
> index a02587d1a7..d16730a2e2 100755
> --- a/t/t6030-bisect-porcelain.sh
> +++ b/t/t6030-bisect-porcelain.sh
> @@ -1029,18 +1029,23 @@ test_expect_success 'bisect state output with multiple good commits' '
>         git bisect reset &&
>         git bisect start >output &&
>         grep "waiting for both good and bad commits" output &&
> +       git bisect log | grep "waiting for both good and bad commits" &&

Having "git" command on the left hand side of pipe would hide a failure signalled by its exit status from the command. The "but if the command fails, how likely would we see the expected output to its standard ouput?" argument aside, it is more common to write

	  git bisect log >output &&
	  grep "..." &&
instead.
Thanks.
Previous: Junio C HamanoNext: Taylor Blau
Message 13 of 19 in “bisect: status improvements when bisect is not fully fleshed out”
  1. 0/2 bisect: status improvements when bisect is not fully fleshed outChris Down, May 6, 2022
  2. 1/2 bisect: output state before we are ready to compute bisectionChris Down, May 6, 2022
  3. Taylor BlauMay 6, 2022
  4. Chris DownMay 6, 2022
  5. Junio C HamanoMay 6, 2022
  6. Junio C HamanoMay 6, 2022
  7. 2/2 bisect: output bisect setup status in bisect logChris Down, May 6, 2022
  8. Taylor BlauMay 6, 2022
  9. Chris DownMay 6, 2022
  10. Taylor BlauMay 9, 2022
  11. Junio C HamanoMay 6, 2022
  12. Junio C HamanoMay 6, 2022
  13. Junio C HamanoMay 6, 2022
  14. Taylor BlauMay 9, 2022
  15. Junio C HamanoMay 9, 2022
  16. Taylor BlauMay 9, 2022
  17. Chris DownMay 7, 2022
  18. Junio C HamanoMay 7, 2022
  19. Chris DownMay 7, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.