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

Re: should "git bisect" support "git bisect next?"

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2017, 01:43 UTC
Message-ID
<xmqqvaigclv0.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171111194616.a2hl4dwz5cycuzdh@thunk.org>
Theodore Ts'o <tytso@mit.edu> writes:
Show 13 quoted lines
> On Sat, Nov 11, 2017 at 11:38:23PM +0900, Junio C Hamano wrote:
>> 
>> Thanks for saving me time to explain why 'next' is still a very
>> important command but the end users do not actually need to be
>> strongly aware of it, because most commands automatically invokes it
>> as their final step due to the importance of what it does ;-)
>
> This reminds me; is there a way to suppress it because I'm about to
> give a large set of good and bit commits (perhaps because I'm
> replaying part of a git biset log, minus one or two lines that are
> suspected of being bogus thanks to flaky reproduction), and so there's
> no point having git bisect figure the "next" commit to try until I'm
> done giving it a list of good/bad commits?

It is surprising that I've never heard of this idea, but I think that it is an excellent one.

When the user knows what bad and good commits in what sequence will be fed to the command (i.e. replaying a saved output of "git bisect log"), ideally we would want to "plug" the auto-next processing, and just mark good and bad in refs/bisect/* without doing anything other than creating these refs, and then run a "next" before giving the control back to present the final working tree to be tested by the user. That would save the cost of intermediate checkouts but also the cost of extra merge-base computation that is done to catch the case where the user gave a good commit that is an ancestor of a bad commit by mistake.

I think that the output of "git bisect log" was designed to be just an executable shell script that the user can edit (the edit is mostly designed to make it possible: "I know I screwed up in this step, so I change its 'bad' to 'good' and remove the remaining lines") and just execute it. Which makes the simplest approach that would first come to my mind not work very well, unfortunately.

	The "simplest approach" would teach the "--no-autonext"
	option to "git bisect good" and "git bisect bad" and skip
	the call to bisect_auto_next in bisect_state when it is
	given.  Then update the output from "git bisect log" to add
	that option to all good/bad commands, and then add an
	explicit "git bisect next" at the end.  This won't work well
	because it is likely that with the "remove the remaining
	lines" step, it is likely that the user would remove the
	final "bisect next".

A workable alternative approach is to teach "git bisect replay" to be more intelligent. Right now, I do not think it does anything more than what happens by an execution of the input file with a shell, but "replay" should be able to read a single step ahead in the command sequence while doing its step-by-step execution, and when it notices that it is about to run "bisect good" or "bisect bad", and if the command to be run after that is also one of these two, it can decide to skip the auto-next processing in the current step. It shouldn't need any new "--no-auto-next" option (I am not saying that adding the option is bad--in fact, I think it is a good addition for expert users; I am just saying that the approach to make "replay" smarter does not require it).

Christian, what do you think?  Am I missing something?
Previous: Theodore Ts'oNext: Christian Couder
Message 5 of 11 in “should "git bisect" support "git bisect next?"”
  1. Robert P. J. DayNov 11, 2017
  2. Christian CouderNov 11, 2017
  3. Junio C HamanoNov 11, 2017
  4. Theodore Ts'oNov 11, 2017
  5. Junio C HamanoNov 12, 2017
  6. Christian CouderNov 12, 2017
  7. Theodore Ts'oNov 12, 2017
  8. Junio C HamanoNov 13, 2017
  9. Robert P. J. DayNov 12, 2017
  10. Junio C HamanoNov 12, 2017
  11. Stephan BeyerNov 12, 2017

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.