git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	"Robert P. J. Day" <rpjday@crashcourse.ca>,
	Git Mailing list <git@vger.kernel.org>,
	Stephan Beyer <s-beyer@gmx.net>
Subject: Re: should "git bisect" support "git bisect next?"
Date: Sun, 12 Nov 2017 15:21:57 +0100	[thread overview]
Message-ID: <CAP8UFD3DzdTf6-yZVwMvc1=nP+ejrinjvE8wAPhdaHoOQOmpGw@mail.gmail.com> (raw)
In-Reply-To: <xmqqvaigclv0.fsf@gitster.mtv.corp.google.com>

On Sun, Nov 12, 2017 at 2:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Theodore Ts'o <tytso@mit.edu> 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.

Yeah I agree that it might be something interesting for the user to do.
But in this case the sequence in which you give the good and the bad
commits is not important.
Only the last bad commit and the set of good commits that were given
are important.

If you can get that and pass it to 'git bisect start' then you will
avoid all the intermediate computation and actually start from the
state you want.

> 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).

To automate that one could start with a dirty oneliner like this:

git bisect start $(git bisect log | perl -ne '$b = $1 if m/# bad:
\[(.*)\]/; push @g, $1 if m/# good: \[(.*)\]/; END { print $b . " ".
join(" ", @g) . "\n"; }')

So yeah we could add an option to "git replay" that would do that.

  reply	other threads:[~2017-11-12 14:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-11 11:42 should "git bisect" support "git bisect next?" Robert P. J. Day
2017-11-11 14:07 ` Christian Couder
2017-11-11 14:38   ` Junio C Hamano
2017-11-11 19:46     ` Theodore Ts'o
2017-11-12  1:43       ` Junio C Hamano
2017-11-12 14:21         ` Christian Couder [this message]
2017-11-12 18:42           ` Theodore Ts'o
2017-11-13  1:40             ` Junio C Hamano
2017-11-12  9:17       ` Robert P. J. Day
2017-11-12  9:56         ` Junio C Hamano
2017-11-12 20:08     ` Stephan Beyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP8UFD3DzdTf6-yZVwMvc1=nP+ejrinjvE8wAPhdaHoOQOmpGw@mail.gmail.com' \
    --to=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rpjday@crashcourse.ca \
    --cc=s-beyer@gmx.net \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).