Web lists-archives.com

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




Theodore Ts'o <tytso@xxxxxxx> writes:

> 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?