- Clone or fork it from here
The motivation for this exercise is to be able to do archaeology with Git on a source code where the bug is difficult to see visually. Finding the offending commit is often more than half the debugging.
The script get_pi.py
approximates pi using terms of the Nilakantha series. It
should produce 3.141519 but it does not. The script broke at some point and
produces 3.57361 using the last commit:
$ python get_pi.py
3.573618985595276
At some point within the 500 first commits, an error was introduced. The only thing we know is that the first commit worked correctly.
Use git bisect
to find the commit which broke the computation.
Write a script that checks for a correct result and use git bisect run
to
find the offending commit automatically.