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

Re: [bug] "git bisect old v3.0" takes 21 mins on Linux repo

From
Jeff King <peff@peff.net>
Date
Jan 17, 2025, 13:14 UTC
Message-ID
<20250117131404.GD2893666@coredump.intra.peff.net>
In-Reply-To
<19472bf2353.2c31e5fd10001.1997220058832133228@zohomail.com>
On Fri, Jan 17, 2025 at 09:31:56AM +0400, Askar Safin wrote:
> I think "git bisect" is very important part of git.

Me too. But that doesn't make it any easier to figure out a more optimized algorithm. ;)

In the meantime, here are some other options:
  1. You can manually pick a commit that is around the midpoint of
     history and try it. That will quickly reduce the search space to
     something more manageable. E.g., maybe try v4.0 and v5.0 and use
     those as your initial good/bad starting points (depending on the
     result). Those might not be the exact halfway point, but it's good
     enough to get started.
  2. In a branchy history like linux.git, you can make the problem space
     much smaller by looking only at the history along the first parent.
     E.g.:
       git bisect start --first-parent
       git bisect good v3.0
       git bisect bad v6.13-rc7
     That runs in about 7 seconds for me. It will probably give you a
     merge commit rather than the exact culprit along the second-parent
     history. But with that merge commit, you can start a new, much
     smaller bisection with it as the "bad" and its first-parent as the
     "good".

Both of those are trading a bit of accuracy in finding the exact midpoint in the early steps. It's perhaps another possible option for git-bisect itself: if we see a very large number of commits, we could try to approximate rather than finding the exact answer. In most histories I'd expect that taking the midpoint of a linearized topo-order would get you a pretty reasonable outcome. E.g.:

  total=$(git rev-list --count v3.0..v6.13-rc7)
  git rev-list --topo-order v3.0..v6.13-rc7 |
  tail -n +$((total / 2)) | head -n 1

runs in about 2s on my machine. The commit it finds, ed194d136769, is pretty close to the middle:

  $ git rev-list --count v3.0..ed194d136769
  526863
  $ git rev-list --count ed194d136769..v6.13-rc7
  543312
-Peff
Previous: Askar SafinNext: Junio C Hamano
Message 9 of 10 in “[bug] "git bisect old v3.0" takes 21 mins on Linux repo”
  1. Askar SafinJan 13, 2025
  2. Askar SafinJan 13, 2025
  3. D. Ben KnobleJan 14, 2025
  4. Jeff KingJan 16, 2025
  5. Jeff KingJan 16, 2025
  6. Jeff KingJan 16, 2025
  7. Junio C HamanoJan 16, 2025
  8. Askar SafinJan 17, 2025
  9. Jeff KingJan 17, 2025
  10. Junio C HamanoJan 17, 2025

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.