Save and replay#
The fixture has 16 commits, and the eleventh introduces the fault. After two answers, the log reads:
# bad: [578e7b2...] c16
# good: [88013b9...] c1
git bisect start 'HEAD' 'HEAD~15'
# good: [a2ed07d...] c8
git bisect good a2ed07d...
# bad: [dccbb7f...] c12
git bisect bad dccbb7f...
The receiver, in a fresh clone:
git bisect replay bisect.log
git bisect view --oneline
Replay checks out c10 and reports one revision left to test after it, which is where the sender stopped. view lists c9 to c12. Git 2.43 produced this output.
Look at the third line before you send the file. git bisect start 'HEAD' 'HEAD~15' holds the names that were typed, and HEAD in another clone can be another commit. Start the bisect with full commit IDs, or replace the names in the file. The bisect manual describes editing the log as the way to undo a wrong answer, so the file is meant to be changed by hand.
Send the test with the log#
Each good and bad line is a claim about a run the receiver did not see. Send what makes the claim checkable:
- The exact command, with its exit code for good and bad.
- How many times you ran it per commit.
- How the project was built at each step, including whether dependencies were reinstalled.
- Each
skipand its reason.
Put the test in a file outside the repository, so that checking out an old commit does not remove it.
Decide whether to trust an answer#
A bisect gives a confident wrong result when one answer is wrong, because every later step depends on it. Before continuing, the receiver reruns the two answers that bound the remaining range: the last good and the first bad. In the fixture those are c8 and c12. If both repeat, continue. If either differs, remove that line from the log and everything after it, then replay.
For an intermittent failure, a good from one run is weak. With a failure that appears in one run of five, a single pass occurs 80% of the time on a bad commit. Ten passes on the same commit occur about 11% of the time (0.8 to the power of 10). Say how many runs stand behind each good.
What else produces the same boundary#
The commit that bisect names is where the test's result changes. A lockfile change, a test fixture or a build flag can move the result without touching the faulty code. A dependency installed at a later version than the old commit had can make all old commits fail. Reading the named commit's diff is the check, and bisecting a browser failure covers the build at each step.
Worked example#
This example is fictional. Ana hands over a log with nine answers and the note "one run each". Ben reruns the last good ten times and it fails twice. He removes that answer and the three after it, replays, and lands four commits earlier. The log kept five of Ana's nine answers usable.
Return to handing over evidence.