Subject: Re: Opinions on bug fix organisation

From: Andy Parkins <[email-masked]>
Date: Wed, 16 May 2007 22:20:13 +0100

On Wednesday 2007, May 16, Junio C Hamano wrote:

> I think that largely depends on your taste and what other things
> you have between B and the tip when you contemplate on the fix.

As always, thank you for the detailed response.  I appreciate the 
thought that goes into answering these questions that flit into my 
mind :-)

> is fixed as close to the introduction of bug as practical (so I
> would _not_ fork a fix on top of B itself, but apply fix to the
> tip of 'maint'), and then all newer development track that
> contain breakage B merges the fix from that branch (i.e. 'maint'
> is then merged into 'master' to propagate the fix forward).

The above method is almost a necessity when using git.  If the bug fix 
is committed to master, there is no way to apply that same commit to 
the maint branch without also grabbing commits you don't want in maint.

> The way 'next' and 'master' works in git.git looks a bit
> different from it, but you will realize that the idea is the
> same if you look at individual topic branches.  Each topic is
> forked from 'master', gain its own commits and merged to 'next'.

I've noticed flows like that when looking at git history.  I always 
think that it demonstrates the power of git's strong-on-branches stance 
because you can almost feel the story of the development without having 
to read any of the commits themselves.  I wonder if other DVCSs 
encourage creation of such a strong narrative?

> Its bugs may be discovered later while it still hasn't been
> merged to 'master'.  I'd _never_ commit a fix to 'next'
> directly, but a fix goes to the tip of the topic branch that
> introduces the bug, and then merged to 'next'.  When the topic
> is reasonably bug-free, it then is merged to 'master' -- at that
> point, the history of the topic has all the relevant fixes.

What is your preference when, for example, you have already merged a 
topic to next but then a bug fix appears?

 * -- * -- * -- M -- F         * -- * -- * -- M -- m (next)
               /        or                   /    /
    B -- * -- *                   B -- * -- * -- F (topic)

F is certainly most appropriate to be on the topic branch, but we create 
a perhaps excessively verbose extra merge, m.

> just a random set of development), I think your latter approach
> to have only the fix as a separate (temporary) topic and merge
> that to the tip is inconsistent with your current practice to
> begin with, and I do not see much merit in it by itself.  If you
> prefer the latter solution (and I obviously do, as that is the

I'm not sure I've understood what you mean here.  Which "latter" are you 
talking about - you've said that you find the latter inconsistent but 
also that you prefer the latter solution.  I'm lost :-)

> way git.git repository is maintained), you would also want to
> have topic branches, where all the enhancements, advances _and_
> fixes related to a single theme go to and then merged to the
> mainline.  That's the history of a theme.  Having branch and
> merge only for fixes but not for advancement may be "the history
> of a bug", but it probably would not buy you much by itself.

It's not so much a matter of it buying you something, it is more that 
when you find that bug fix commit in history you can see, by following 
the fix-branch back to its source, all the revisions that contained 
that bug at a glance; if you just commit on the end, you have to do the 
digging yourself, and hope that someone mentioned in the commit message 
which commit introduced the bug that that commit fixes.

The fact that git makes it so easy to branch and merge from a previous 
point is the thing that even makes this a possibility.  Perhaps I'm 
spoilt now :-)

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
[email-masked]