Skip to contentSkip to conversation

"git bisect" takes exactly one bad commit and one or more good?

DISCUSSION Robert P. J. Day 5 participants 7 messages Nov 11, 2017 – Nov 12, 2017

lore
Share & tools
lore
#0 lore raw

more on "git bisect" ... the man page seems to make it clear that
bisection takes *precisely* one "bad" commit, and one *or more* good commits, is that correct? seems that way, given the ellipses in the commands below:

  git bisect start [--term-{old,good}=<term> --term-{new,bad}=<term>]
                   [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
  git bisect (bad|new|<term-new>) [<rev>]
  git bisect (good|old|<term-old>) [<rev>...]

however, other parts of the man page seem less clear. just below that, a description that bisection takes "a" good commit:

"You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced."

and a bit lower, we read "at least one bad ...", which some people might interpret as one or more *bad* commits:

"Once you have specified at least one bad and one good commit, git bisect selects a commit in the middle of that range of history, checks it out, and outputs something similar to the following:"

if the rules are exactly one bad commit and one or more good, i'll
submit a patch to reword at least the above, and possibly more if necessary.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 4 lines · Robert P. J. Day

more on "git bisect" ... the man page seems to make it clear that
bisection takes *precisely* one "bad" commit, and one *or more* good commits, is that correct?

Yeah, that's true.

Quoted 7 lines

seems that way, given the ellipses in the
commands below:

  git bisect start [--term-{old,good}=<term> --term-{new,bad}=<term>]
                   [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
  git bisect (bad|new|<term-new>) [<rev>]
  git bisect (good|old|<term-old>) [<rev>...]

Yeah indeed.

Quoted 6 lines

however, other parts of the man page seem less clear. just below that, a description that bisection takes "a" good commit:

"You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced."

Yeah, 'and at least a "good" commit' would be better.

Quoted 6 lines

and a bit lower, we read "at least one bad ...", which some people might interpret as one or more *bad* commits:

"Once you have specified at least one bad and one good commit, git bisect selects a commit in the middle of that range of history, checks it out, and outputs something similar to the following:"

Yeah, 'Once you have specified one bad and at least one good commit' would be better.

Quoted 3 lines

if the rules are exactly one bad commit and one or more good, i'll
submit a patch to reword at least the above, and possibly more if necessary.

Sure, thanks,
Christian.

#2 lore raw
Quoted 5 lines · Christian Couder
Quoted 3 lines

"You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced."

Yeah, 'and at least a "good" commit' would be better.

Make it "at least one" instead, perhaps?

I somehow thought that you technically could force bisection with 0 good commit, even though no sane person would do so. For the matter, in practice nobody starts with more than one good commit, and for that reason, I doubt that the proposed change to overstress the fact that you could give two or more "good" ones when starting has that much practical value. The tradeoff of losing the clarity coming from giving only the simplest usage pattern for trying to be technically more correct that is proposed by this change does not sound too good, but it may be just me (who prefers white lies in the end-user docs when it buys us more simplicity and clarity). .

#3 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · Christian Couder
Quoted 3 lines

"You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced."

Yeah, 'and at least a "good" commit' would be better.

Make it "at least one" instead, perhaps?

Quoted 10 lines

I somehow thought that you technically could force bisection with 0 good commit, even though no sane person would do so. For the matter, in practice nobody starts with more than one good commit, and for that reason, I doubt that the proposed change to overstress the fact that you could give two or more "good" ones when starting has that much practical value. The tradeoff of losing the clarity coming from giving only the simplest usage pattern for trying to be technically more correct that is proposed by this change does not sound too good, but it may be just me (who prefers white lies in the end-user docs when it buys us more simplicity and clarity). .

i realize that one of each commit is the simplest use case, but the
scenario that occurred to me is a bunch of branches being merged and, suddenly, you have a bug, and you're not sure where it came from so you identify a number of good commits, one per merged branch, and go from there.

also, making it clear you can have more than one good commit is
consistent with the synopses, which use ellipses to represent that very thing.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#4 lore raw
Quoted 8 lines · Robert P. J. Day

i realize that one of each commit is the simplest use case, but the
scenario that occurred to me is a bunch of branches being merged and, suddenly, you have a bug, and you're not sure where it came from so you identify a number of good commits, one per merged branch, and go from there.

Just thinking out loud, couldn't you give the one commit that was the tip of the branch, to which you merged the branches, before you merged in the branches as the good commit ?

Signature · 1 line
Kaartic
#5 lore raw
In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Christian Couder
Quoted 3 lines

"You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced."

Quoted 6 lines
Quoted 1 line

Yeah, 'and at least a "good" commit' would be better.

Make it "at least one" instead, perhaps?

I somehow thought that you technically could force bisection with 0 good commit, even though no sane person would do so...

i do see the following snippet in bisect_next_check():

  bisect_next_check() {

... snip ...

        case "$missing_good,$missing_bad,$1" in
        ,,*)
                : have both $TERM_GOOD and $TERM_BAD - ok
                ;;
        *,)
                # do not have both but not asked to fail - just report.
                false
                ;;
        t,,"$TERM_GOOD")
                # have bad (or new) but not good (or old).  we could bisect although
                # this is less optimum.
                eval_gettextln "Warning: bisecting only with a \$TERM_BAD commit." >&2

... snip ...

so i guess it's possible.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#6 lore raw
In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Christian Couder
Quoted 3 lines

"You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced."

Quoted 6 lines
Quoted 1 line

Yeah, 'and at least a "good" commit' would be better.

Make it "at least one" instead, perhaps?

I somehow thought that you technically could force bisection with 0 good commit, even though no sane person would do so.

Thanks for pointing that out but I disagree with the part after "even though" :)

Imagine you add a test case that was totally uncovered before and now reveals a bug. You want to find the introduction of the bug, so you can either check out the first commit you think where that bug did not exist, then you find out that its also a bad commit, so you check out another commit... essentially you are manually doing a "bisect" but less efficient. So it would be better to let "git bisect" do its job without knowing a good commit in advance. Sounds perfectly sane to me.

The probably insane thing is that there are currently performance issues with git bisect. So you *are* probably faster by guessing. But that is what my patch series [1] was about (and that I postponed in favor of other conflicting work on bisect).

1.
https://public-inbox.org/git/[email protected]/

Cheers
Stephan