Re: [RFC] Add bad-branch-first option for git-bisect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Jan 24, 2011 at 3:03 AM, Shuang He <shuang.he@xxxxxxxxx> wrote:
> Hi
>     The default git-bisect algorithm will jump around the commit tree,
> on the purpose of taking least steps to find the first culprit commit.
> We may find it sometime would locate a old culprit commit that we're not
> concerned about anymore.

Yes, it can be a problem.

>     In most software development, there's one or two main branch which
> is maintained for release, and a bunch of feature branches are created
> for new feature development or bug fix.  For the reason that sometime
> git-bisect will locate a old culprit commit would be:
>         1. Quality of those branches may not match the main branch,
> some functionality are broken at first and fixed later on the feature
> branch. If git-bisect jump to there by chance, git-bisect will only find
> that old
> culprit commit which only exists on that feature branch

If the quality of these branches is too bad, I think they should not
have been merged in the first place.
If they are not merged (and not marked as good), then git bisect will
not look at them, since it will look only at commits that are
ancestors of the bad commit it is given.

Or if one is merged but it causes too many problems, then perhaps a
replacement commit could be used to unmerge the branch.

Another possibility is to have in a file a list of commits that are
the last commits on these branches before the merge commits, and do a:

git bisect good $(cat good_commits_file.txt)

at the beginning of each bisection.

So I think the long term solution in this case is not what your are suggesting.

>         2. Some of those branches may not synchronized with main
> branch in time.  Say feature1 is broken when feature2 branch is created, and
> feature1 is fixed just a moment later after feature2 branch is created,
> and when feature2's development is done, and developer want to merge
> feature2 branch back to master branch, feature2 will be firstly
> synchronized to master branch tip, then merge into master.  For the same
> reason addressed in issue 1, this will also lead git-bisect into wrong
> direction.

I am not sure what you mean by " feature2 will be firstly synchronized
to master branch tip", and I think this should mean a rebase that
would fix the bug if feature1 has already been merged into the master
branch.

But anyway in this case, I think that git bisect will find that the
first bad commit is the last commit in the branch, just before it was
merged. And by looking at the branch graph it should be quite easy to
understand what happened.

And then the obvious thing to do is to decide to just start a new
bisection like it was started the first time but with an added "git
bisect good <merge_commit>", where <merge_commit> is the commit that
merges the branch.

>     In all, we think we do not care about branches that we're not
> currently working, unless we're sure the regression is caused by that
> branch.
>
>     To address those issue, we propose to add a new config option:
>         core.bisectbadbranchfirst::
>             With this algorithm, git-bisect will always try to select
> commits
>             that on the same branch current bad commit sits. And will
> fall back
>             to default git-bisect algorithm when bad-branch-first
> algorithm does
>             not apply
>         +
>         This setting defaults to "false".

I am not opposed to an option to bisect on the first parents of the
bad commit only. And after a very fast look at your patch it seems to
be what it does. By the way Avery Pennarun's gitbuilder
(https://github.com/apenwarr/gitbuilder) does the same thing. So I
know some people are interested in such a feature.

But here are some suggestions/comments:

- your explanations about why it could be useful should be improved,
- the name "bisectbadbranchfirst" seems wrong to me, because git
branches are just some special tags; "firstparentsonly" would be a
better name,
- before having a config option for it, why not have it first as an
option to "git bisect start",
- if there is a config option, then there should probably be an option
to "git bisect start" to use the regular algorithm,
- it seems to me that bisecting only on first parents could fail only
if some "good" commits are not ancestors of the bad commit, and if the
bug is fixed on a branch where such a commit is; so I don't see the
point in defaulting to the usual algorithm in this case because in
this case the usual algorithm just stops,
- perhaps the message given when the first bad commit is found should
be changed a little bit when this option is used.

Maybe I am missing something, because as I said I didn't read your
patch carefully, but in this case please try to give a concrete
example.

Thanks,
Christian.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]