|
|
Subscribe / Log in / New account

Stochastic bisection in Git

Stochastic bisection in Git

Posted Dec 14, 2021 20:50 UTC (Tue) by mathstuf (subscriber, #69389)
In reply to: Stochastic bisection in Git by NYKevin
Parent article: Stochastic bisection in Git

> git bisect log and git bisect replay already do exactly that.

Oh nifty. I knew of `log`, but had missed `replay`. However, I feel that `git bisect undo [n]` would also be useful (at least to avoid touching files all over the place in the process of restarting since I suspect that the replay is not done purely in-index quite yet[1]).

> You can build it yourself out of git bisect run, although built-in functionality would be Nice To Have. But if you've already turned the test into a single command, writing a wrapper script that applies/reverts a fixed patch is not *that* much extra work.

Sure, but that's generally a "hindsight is 20/20" situation. The problem is usually that such things are discovered in the process of bisecting, so by the time I have a robust reproducer script to give to `git bisect run`, I've already done a bisection…

[1] Willing to be pleasantly surprised though :) .


to post comments

Stochastic bisection in Git

Posted Dec 14, 2021 21:24 UTC (Tue) by NYKevin (subscriber, #129325) [Link]

You could just use something like this script:

#!/bin/bash

patch -p2 /path/to/file.diff # Replace 2 with the correct number.
git show -s --oneline
echo "Press ^D when finished testing this commit."
bash
echo -n "Was this commit (G)ood, (B)ad, or (S)kip? "
read REPLY
git reset --hard HEAD
case "$REPLY" in
g|good) exit 0;;
b|bad) exit 1;;
s|skip) exit 125;;
*) echo "Unrecognized input, aborting."; exit -1;;
esac

You would still need to handle the "what if patch(1) fails?" case, though.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds