~~~~~~~~~~
If you have a script that can tell if the current source code is good
- or bad, you can automatically bisect using:
+ or bad, you can bisect by issuing the command:
------------
-$ git bisect run my_script
+$ git bisect run my_script arguments
------------
- Note that the "run" script (`my_script` in the above example) should
- exit with code 0 in case the current source code is good. Exit with a
+ Note that the script (`my_script` in the above example) should
+ exit with code 0 if the current source code is good, and exit with a
code between 1 and 127 (inclusive), except 125, if the current
source code is bad.
$ git bisect run ~/test.sh
------------
+
- Here "check_test_case.sh" should "exit 0", if the test case passes,
- and "exit 1" (for example) otherwise.
+ Here "check_test_case.sh" should "exit 0" if the test case passes,
+ and "exit 1" otherwise.
+
- It's safer if both "test.sh" and "check_test_case.sh" scripts are
- outside the repo to prevent interactions between the bisect, make and
- test processes and the scripts.
+ It is safer if both "test.sh" and "check_test_case.sh" scripts are
+ outside the repository to prevent interactions between the bisect,
+ make and test processes and the scripts.
+* Automatically bisect a broken test suite:
++
+------------
+$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
+$ git bisect run sh -c "make || exit 125; ~/check_test_case.sh"
+------------
++
+Does the same as the previous example, but on a single line.
+
Author
------
Written by Linus Torvalds <torvalds@osdl.org>