threads / discuss / 47166

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

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

## tl;dr

7 messages between Nov 11, 2017 and Nov 12, 2017.

replies: 6people: 5as markdown or json

Robert P. J. Day· Nov 11, 2017, 11:22 UTC · lore
  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
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Christian Couder· Nov 11, 2017, 12:01 UTC · re: Robert P. J. Day · lore

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

On Sat, Nov 11, 2017 at 12:22 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:

>
>   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.
Show 7 quoted 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.
Show 6 quoted 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.
Show 6 quoted 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.

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

Junio C Hamano· Nov 11, 2017, 14:34 UTC · re: Christian Couder · lore

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

Christian Couder <christian.couder@gmail.com> writes:
Show 5 quoted 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). .

Robert P. J. Day· Nov 11, 2017, 15:27 UTC · re: Junio C Hamano · lore

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

On Sat, 11 Nov 2017, Junio C Hamano wrote:
Show 20 quoted lines
> Christian Couder <christian.couder@gmail.com> writes:
>
> >> "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). .
  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
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Kaartic Sivaraam· Nov 12, 2017, 12:14 UTC · re: Robert P. J. Day · lore

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

On Sat, 2017-11-11 at 10:27 -0500, Robert P. J. Day wrote:
Show 8 quoted lines
> 
>   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 ?

-- 
Kaartic
Robert P. J. Day· Nov 11, 2017, 16:03 UTC · re: Junio C Hamano · lore

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

On Sat, 11 Nov 2017, Junio C Hamano wrote:
Show 12 quoted lines
> Christian Couder <christian.couder@gmail.com> writes:
>
> >> "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...
  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
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Stephan Beyer· Nov 12, 2017, 21:13 UTC · re: Junio C Hamano · lore

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

On 11/11/2017 03:34 PM, Junio C Hamano wrote:
Show 12 quoted lines
> Christian Couder <christian.couder@gmail.com> writes:
> 
>>> "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.

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/1460294354-7031-1-git-send-email-s-beyer@gmx.net/

Cheers Stephan

← back to recent threads