I'm aware that git bisect is branch-aware by design, so that if between good commit, G, and bad commit, B, you merged in a branch, it needs to take those changes into consideration as well, as the bug may be contained in the branch.
In my case I have a dependency as a side branch and I merge in changes to my main project from time to time. The dependency can be considered a library that has a different way of running, different build-system etc. from my main project, but I still want recent changes from it via merges to the main branch.
The problem is then that while bisecting in this scenario, you end up on non-compilable commits in the commits from the dependency.
I would really just want to consider each branch merge as a single commit while doing the bisection.
A workaround I've found so far is making a list of valid commits G..B with git log --first-parent, and then while bisecting, do git bisect skip if the current commit isn't in that list. That takes a lot of time though (lots of files to checkout/change for each skip).
So the question is: Is there any way of doing --first-parent with git bisect or providing a list of commits i feel are valid to be able to avoid checking out branches I know already are not compilable? How do we only check the commits marked o in the diagram?
G---o---o---o---o---o---o---B main project branch / / / x---x---x---x---x dependency \ / x' dependency project taskbranch
Edit: added diagram for clarity
I've been looking for something like this too. As far as I've got is that
git rev-list --bisect --first-parent
seems to do what you want to, and the docs for rev-list implies that the--bisect
option is what bisect uses internally - but gettinggit bisect
to add that flag to its call(s) to rev-list seems less trivial:The bisect command is implemented by a shell script git-bisect, which in turn uses a builtin command
bisect--helper
to actually do the interesting part ("computation, display and checkout" says the comment...), apparently based on a bunch of magic state files in .git/. And it seems to be the rev-list command that is reusing code from bisect--helper rather than the other way around as you might expect.So, you'd have to extend the bisect--helper code's commit filtering to do it, I think.
As a workaround, something like this might work: after bisect checks something out for you, reset to a different one using
git rev-list --bisect --first-parent
, test that and mark it good/bad/skip and continue from there.