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

Re: Git bisect does not find commit introducing the bug

From
Johannes Sixt <j6t@kdbg.org>
Date
Feb 18, 2017, 14:18 UTC
Message-ID
<477d3533-d453-9499-e06e-72f45488d421@kdbg.org>
In-Reply-To
<CAMX8fZVkBU6M8fkUcRr69V97_NTSOGGmPB1U-ObhmVv3i6wQhg@mail.gmail.com>
Am 18.02.2017 um 12:15 schrieb Alex Hoffman:
Show 6 quoted lines
> No one commented the fact, that I find this very confusing. Don't you
> find this confusing? I will underline, that 'git bisect good v.good'
> will fail if the commit 'v.good' is not a parent of the bad commit,
> meaning there MUST be at least a path between 'v.good' and 'v.bad',
> thus I would expect it looks on this path ONLY. Beside that, this is
> what I understand by 'binary search' (to search on this commit path).

But this is not how Git works. Git computes graph differences, i.e., it subtracts from the commits reachable from v.bad those that are reachable from v.good. This leaves more than just those on some path from v.good to v.bad. And it should work this way. Consider this history:

--o--o--o--G--X
    \           \
     x--x--x--x--X--B--

When you find B bad and G good, than any one of the x or X may have introduced the breakage, not just one of the X.

Show 6 quoted lines
>> Correct. The assumption of bisection is that there is only one
>> transition between GOOD and BAD. By violating that assumption,
>> anything  can happen.
>
> I did not find that in the manpage or did I miss it? Why would someone
> assume that the commit graph looks in a certain way?

There is no restriction in the commit graph. The only restriction, actually assumption, is that there is *one* transition from good to bad and no transition from bad to good. Otherwise, bisection cannot work.

Show 7 quoted lines
> I assume, that
> 'git bisect' was not thought through and that it considers the first
> directed path between v.good and v.bad, instead of all paths (in my
> example graph there are two such paths). I will also underline that
> git bisect was designed to work with multiple good commits and one bad
> commit (also multiple paths), but probably NOT with multiple paths
> between the same pair of good and bad commits.

Oh, IMO git bisect was well thought through. If it considered just paths from good to bad, it would not given the correct answer. See the example history above. Bisect authors would not have deemed that sufficiently good ;)

-- Hannes
Previous: Alex HoffmanNext: Alex Hoffman
Message 5 of 26 in “Git bisect does not find commit introducing the bug”
  1. Alex HoffmanFeb 17, 2017
  2. Stephan BeyerFeb 17, 2017
  3. Johannes SixtFeb 18, 2017
  4. Alex HoffmanFeb 18, 2017
  5. Johannes SixtFeb 18, 2017
  6. Alex HoffmanFeb 18, 2017
  7. Christian CouderFeb 18, 2017
  8. Alex HoffmanFeb 19, 2017
  9. Alex HoffmanFeb 19, 2017
  10. Christian CouderFeb 19, 2017
  11. Johannes SixtFeb 19, 2017
  12. Alex HoffmanFeb 19, 2017
  13. Jacob KellerFeb 19, 2017
  14. Oleg TaranenkoFeb 20, 2017
  15. Jakub NarębskiFeb 20, 2017
  16. Oleg TaranenkoFeb 20, 2017
  17. Alex HoffmanFeb 20, 2017
  18. Jakub NarębskiFeb 20, 2017
  19. Alex HoffmanFeb 20, 2017
  20. Philip OakleyFeb 20, 2017
  21. Alex HoffmanFeb 21, 2017
  22. Philip OakleyFeb 21, 2017
  23. Junio C HamanoFeb 20, 2017
  24. Philip OakleyFeb 18, 2017
  25. Hilco WijbengaFeb 18, 2017
  26. Johannes SixtFeb 18, 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.