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

Re: [PATCH v2 1/2] bisect: output state before we are ready to compute bisection

From
Taylor Blau <me@ttaylorr.com>
Date
May 6, 2022, 02:52 UTC
Message-ID
<YnSNWMBRZA0S8X26@nand.local>
In-Reply-To
<11edd3e4dbaac7fada8a3bcd43f4bbd353087637.1651796862.git.chris@chrisdown.name>
On Fri, May 06, 2022 at 01:52:46AM +0100, Chris Down wrote:
Show 5 quoted lines
> In order to avoid situations like this, make it more clear what we're
> waiting for:
>
>     $ git bisect start d93ff48803f0 v6.3
>     status: waiting for good commit(s), bad commit known

Makes sense. It would be kind of nice to realize that (in your example) "v6.3" likely wasn't a pathspec that matched any files, either, and after trying to DWIM it into something sensible, printed an error and quit.

But I think the behavior here is slightly more subtle, since we really care about whether or not a pathspec would match any revisions along the bisection, not just the tips or the currently checked-out revision.

So I think the approach here makes sense.
Show 17 quoted lines
> +static void bisect_print_status(const struct bisect_terms *terms)
> +{
> +	const struct bisect_state bs = bisect_status(terms);
> +
> +	/* If we had both, we'd already be started, and shouldn't get here. */
> +	if (bs.nr_good && bs.nr_bad)
> +		return;
> +
> +	if (!bs.nr_good && !bs.nr_bad)
> +		printf(_("status: waiting for both good and bad commits\n"));
> +	else if (bs.nr_good)
> +		printf(Q_("status: waiting for bad commit, %d good commit known\n",
> +			  "status: waiting for bad commit, %d good commits known\n",
> +			  bs.nr_good), bs.nr_good);
> +	else
> +		printf(_("status: waiting for good commit(s), bad commit known\n"));
> +}

Could or should these printf()'s be advise() calls instead? That would make it easier for users to turn them off if they don't want the extra output. At the very least, we should make sure that they are sent to stderr to discourage scripting around them.

Thanks, Taylor

Previous: Chris DownNext: Chris Down
Message 3 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.