Petr Skocik
Petr Skocik

Reputation: 60127

Using git bisect to find the latest commit that doesn't build

I'm dealing with a repo where the latest commit build but the old ones don't. I tried using git bisect (which I'm new to) to find the latest commit that doesn't build.

I did

git bisect start HEAD non_buildable_commit
git bisect run ./test_script #run git bisect good if the build fails, bad if it suceeds

And I got bisect run success

How do I get the latest non-buildable commit now?

Upvotes: 1

Views: 66

Answers (1)

alfunx
alfunx

Reputation: 3150

git bisect start HEAD non_buildable_commit
git bisect run ./test_script

test_script: run git bisect good if the build fails, bad if it suceeds

That's not what the script is supposed to do. The script should exit with 0 if the commit is good (as defined by bisect) or with a code in 1-127 (except 125) if the commit is bad.

In your case, if the build fails, you should exit with exit 0, otherwise something like exit 1.

Upvotes: 2

Related Questions