Note #15

Bisecting as a general purpose program (instead of Git/source control specific) and my suggestions for how this should work from the usage point of view.

The following excerpts from Git - git-bisect Documentation:

Basic bisect commands: start, bad, good

As an example, suppose you are trying to find the commit that broke a feature that was known to work in version v2.6.13-rc2 of your project. You start a bisect session as follows:

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:

Terminal window
$ git bisect start
$ git bisect bad # Current version is bad
$ git bisect good v2.6.13-rc2 # v2.6.13-rc2 is known to be good
$ git bisect
Bisecting: 675 revisions left to test after this (roughly 10 steps)
$ git bisect bad
Bisecting: 337 revisions left to test after this (roughly 9 steps)
$ git bisect good

The previous usage demonstrates the basics a Git bisect. Additionally, it can be automated too.

Note that the script (my_script in the above example) should exit with code 0 if the current source code is good/old, and exit with a code between 1 and 127 (inclusive), except 125, if the current source code is bad/new.

Terminal window
$ git bisect run my_script arguments

Git bisect is very cool. I had the idea of a more general purpose approach that isn’t necessarily tied to source control. There are some considerations that need satisfactory solutions though. When using Git bisect we are working within the context of a stream of commits that are selected as part of a binary search. That means the bisect input is well defined.

With a general purpose bisect, what do those inputs look like? These are some possible usage patterns.

  • Invoke two programs sequentially and compare the outputs
    • Is the output different/longer/greater than/less than a value?
    • Does one program have a non-zero exit code, or do both programs have different exit codes?

But this still does not explain what the input should look like. What would the bisect program pass as arguments to both processes?

This is something I need to think about. WIP.

Read the rest of my notes

© Lloyd Atkinson 2024 ✌

I'm available for work 💡