2

It is normal to have intermediate commits that failed to compile or broken in other way in feature branch in gitflow model.

Only the matter is to be stable at point of merge to develop branch where review and automatic tests applied.

Can git bisect over develop branch without hitting broken intermediate commits from feature branches?

I do not like to adapt my bisect test scrips to skip/workaround broken commits from feature development...

One way I think about solving a problem is to tell Git somehow walk only across merge changesets...

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
gavenkoa
  • 45,285
  • 19
  • 251
  • 303

1 Answers1

1

Considering the way git bisect pick the next commit to examine (through PRNG -- pseudo random number generator), you could consider making a wrapper.

That wrapper would:

  • call git bisect
  • for each commit, it would double-check if the commit has more than one-parent
  • if not, it would call git bisect skip

That way, your bisect test script remains unchanged.

A workaround is described in "How do you get git bisect to ignore merged branches?" by David Ness.

I wrote a Python script to help do this on GitHub.
If you run this script, it will try to trace backwards and follow your branch and emit a list of commit ids that are the tips of the branches that are merged into your branch.
With this list, you can give these to "git bisect good" and bisect will then omit all of the commits on the merged branches from your bisection, achieving the desired result.

That might not be exactly your case, but the idea remain: compute the list of commits you do not want, and feed them to git bisect good.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Is it possible to tell `git bisect` to use only *left* child in DAG? We can enforce direction of merge commits in review/integration server. – gavenkoa Feb 25 '17 at 07:12
  • @gavenkoa it was until Git 2.4: see my comment of http://stackoverflow.com/a/5639046/6309 – VonC Feb 25 '17 at 07:13
  • @gavenkoa That linked question I just mentioned included a possible workaround that I have referenced in my answer. – VonC Feb 25 '17 at 07:17
  • With Mercurial it possible to provide revsets to skip `hg bisect --skip 'not tagged()'`. Having named branches it allows you to limit search space to specific branch: `hg bisect --skip 'not branch(develop)'` – gavenkoa Feb 25 '17 at 07:52