git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bisect limited to Merge Commits
@ 2016-04-27 20:45 Hagen Paul Pfeifer
  2016-04-27 20:56 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Hagen Paul Pfeifer @ 2016-04-27 20:45 UTC (permalink / raw)
  To: git

Hey,

are there any plans to add an option to skip all non-merge commits via
bisecting?

git bisect start --merges-only

Imagine a "rebase feature branch" style of development. All features are
developed on separate features branch which are rebased on master and
immediately merged into the upstream master. Now think about lazy programmers
who miss to check the build process at each commit - leading to many
unbuildable commits. The only guaranteed buildable commit is often the merge
commit.

Bisecting only merge commits will reduce the amount of skip commands (think
about many unbuildable commits) and reduce the number of tests.

Any comments on this idea? What about extending bisect.c:do_find_bisection()


	hgn

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bisect limited to Merge Commits
  2016-04-27 20:45 Bisect limited to Merge Commits Hagen Paul Pfeifer
@ 2016-04-27 20:56 ` Junio C Hamano
  2016-04-27 21:33   ` Johannes Sixt
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-04-27 20:56 UTC (permalink / raw)
  To: Hagen Paul Pfeifer; +Cc: git

Hagen Paul Pfeifer <hagen@jauu.net> writes:

> Imagine a "rebase feature branch" style of development. All features are
> developed on separate features branch which are rebased on master and
> immediately merged into the upstream master. 

I do not want to imagine such ;-)  The only semi-sensible reason why
people might want to always rebase on top of 'master' is to keep the
history completely linear, so with such a workflow, there won't be a
merge commit.

But I think "rebase" part of your description is a red herring.  If
a development goes by always doing a new feature in a side branch
and then merge the branch only after it is done to the 'master'
branch, then bisecting only the commits on first-parent chain would
often be a quick first-pass to find the topic whose merge into the
'master' branch introduced a breakage.  From there you can dig down
to each individual commit on the side branch.  And for that, it is
immaterial that the side branch gets rebased on 'master' and forced
to become a merge with "--no-ff", of the side branch was developed
on older upstream but in a careless way full of "oops, previous one
I broke the entire world and it does not even compile; this commit
fixes it" commits.

So being able to stop at only commits on the first-parent chain is a
valid and useful tool.  "git bisect --first-parent" is one of the
things that are sometimes asked for.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bisect limited to Merge Commits
  2016-04-27 20:56 ` Junio C Hamano
@ 2016-04-27 21:33   ` Johannes Sixt
  2016-04-27 22:25     ` Junio C Hamano
  2016-04-28  6:19     ` Hagen Paul Pfeifer
  0 siblings, 2 replies; 6+ messages in thread
From: Johannes Sixt @ 2016-04-27 21:33 UTC (permalink / raw)
  To: Hagen Paul Pfeifer; +Cc: Junio C Hamano, git

Am 27.04.2016 um 22:56 schrieb Junio C Hamano:
> So being able to stop at only commits on the first-parent chain is a
> valid and useful tool.  "git bisect --first-parent" is one of the
> things that are sometimes asked for.

With origin pointing to git.git, I attempted this:

  git bisect start
  git rev-list --first-parent --boundary origin..origin/pu |
    sed -ne s/-//p | xargs git bisect good
  git bisect bad origin/pu

and it starts bisecting among the 50-something first-parent commits 
between origin and origin/pu.

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bisect limited to Merge Commits
  2016-04-27 21:33   ` Johannes Sixt
@ 2016-04-27 22:25     ` Junio C Hamano
  2016-04-28  6:19     ` Hagen Paul Pfeifer
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2016-04-27 22:25 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Hagen Paul Pfeifer, git

Johannes Sixt <j6t@kdbg.org> writes:

> Am 27.04.2016 um 22:56 schrieb Junio C Hamano:
>> So being able to stop at only commits on the first-parent chain is a
>> valid and useful tool.  "git bisect --first-parent" is one of the
>> things that are sometimes asked for.
>
> With origin pointing to git.git, I attempted this:
>
>  git bisect start
>  git rev-list --first-parent --boundary origin..origin/pu |
>    sed -ne s/-//p | xargs git bisect good
>  git bisect bad origin/pu
>
> and it starts bisecting among the 50-something first-parent commits
> between origin and origin/pu.

That is a cute idea but I wonder if it would work well in a history
full of pointless no-ff merges.

Here is a sample topology (output from "git log --oneline --graph")

    *   84ef1bb pointless
    |\  
    | * 4ae9f68 third
    |/  
    *   aec8732 pointless
    |\  
    | * fd4ed0d second
    |/  
    * 696b5c1 initial

where the tip of 'master' was initial, a side branch built 'second'
on it and then 'master' made a no-ff 'pointless' merge, another side
branch built 'third' on it and then 'master' again made a no-ff
'pointless' merge.

    $ git rev-list --first-parent --boundary initial..pointless

would give us 'third' and 'second' as boundaries, but by marking
'third' as GOOD, we declare to 'bisect' machinery that it and all of
its ancestors are GOOD.  So upon seeing 'bisect bad HEAD', we would
immediately see that HEAD is the first bad commit, wouldn't we?

Actually, "pointless no-ff merges" is a red herring.  Any history
with side branch that branched from the first-parent chain after the
commit at the bottom of the bisection range (in this example, the
side branch that built 'third' was forked off of the first 'pointless'
commit on the first-parent chain of 'master', which was made after
the bottom of the range 'initial') would have the same problem, I
would imagine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bisect limited to Merge Commits
  2016-04-27 21:33   ` Johannes Sixt
  2016-04-27 22:25     ` Junio C Hamano
@ 2016-04-28  6:19     ` Hagen Paul Pfeifer
  2016-04-28  6:44       ` Jacob Keller
  1 sibling, 1 reply; 6+ messages in thread
From: Hagen Paul Pfeifer @ 2016-04-28  6:19 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

* Johannes Sixt | 2016-04-27 23:33:53 [+0200]:

Hey Junio, hey Hannes,

> git bisect start
> git rev-list --first-parent --boundary origin..origin/pu |
>   sed -ne s/-//p | xargs git bisect good
> git bisect bad origin/pu
>
>and it starts bisecting among the 50-something first-parent commits between
>origin and origin/pu.

just for clarification: contributors rebase their work before pushing it on
master. The integrator simple merges --no-ff the individual branches. Just a
regular workflow, nothing special - except that many contributor commits will
not build. ;(

The idea is just to skip the contributor commits during bisect and focus on
the merge commits (the ones with more than one ancestors) because they are
likely build and testable.

One possible approach is probably to sort out all non-merge commits before
bisecting and bisect only on a this set of commits. The advantage is that the
first bad commit is the merge commit introduced the regression. Mmmh, any
comments?

hgn

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bisect limited to Merge Commits
  2016-04-28  6:19     ` Hagen Paul Pfeifer
@ 2016-04-28  6:44       ` Jacob Keller
  0 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2016-04-28  6:44 UTC (permalink / raw)
  To: Hagen Paul Pfeifer; +Cc: Johannes Sixt, Junio C Hamano, Git mailing list

On Wed, Apr 27, 2016 at 11:19 PM, Hagen Paul Pfeifer <hagen@jauu.net> wrote:
> * Johannes Sixt | 2016-04-27 23:33:53 [+0200]:
>
> Hey Junio, hey Hannes,
>
>> git bisect start
>> git rev-list --first-parent --boundary origin..origin/pu |
>>   sed -ne s/-//p | xargs git bisect good
>> git bisect bad origin/pu
>>
>>and it starts bisecting among the 50-something first-parent commits between
>>origin and origin/pu.
>
> just for clarification: contributors rebase their work before pushing it on
> master. The integrator simple merges --no-ff the individual branches. Just a
> regular workflow, nothing special - except that many contributor commits will
> not build. ;(
>
> The idea is just to skip the contributor commits during bisect and focus on
> the merge commits (the ones with more than one ancestors) because they are
> likely build and testable.
>
> One possible approach is probably to sort out all non-merge commits before
> bisecting and bisect only on a this set of commits. The advantage is that the
> first bad commit is the merge commit introduced the regression. Mmmh, any
> comments?
>

I suspect doing something akin to the idea of "bisect --first-parent"
would work for this use case and be more flexible in general. Your
idea is pretty much what i think bisect --first-parent would do,
except that it would also work for non-merge commits which happen to
be in the "mainline" history.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-28  6:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 20:45 Bisect limited to Merge Commits Hagen Paul Pfeifer
2016-04-27 20:56 ` Junio C Hamano
2016-04-27 21:33   ` Johannes Sixt
2016-04-27 22:25     ` Junio C Hamano
2016-04-28  6:19     ` Hagen Paul Pfeifer
2016-04-28  6:44       ` Jacob Keller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).