Subject: Re: Correction for post-receive-email

From: Andy Parkins <[email-masked]>
Date: Fri, 5 Oct 2007 15:29:43 +0100

On Friday 2007 October 05, Bill Lear wrote:

> I have a few changes I would like to see in this script, ones that I think
> would make it generally more useful.  I don't have a clean patch, though,
> so should I just submit suggestions to you directly, Andy?

Me; or the list. Or both.

I'm happy to try to accommodate any suggestions.  I'm happy if it is useful to 
anyone other than just me :-)

--- SNIP THIS BIT IF YOU'RE NOT INTERESTED IN ITS BUGS ---
The big fault in it as it stands is that it doesn't try to reorder the refs 
being updated to the most logical form.  For example:

 O --- * --- A (ref2)
              \
               B (ref1)

Let's say that both ref1 and ref2 were originally at O and this push has moved 
them to these new locations.  The email hook gets sent this information like 
this:

 refs/heads/ref1 O B
 refs/heads/ref2 O A

The hook iterates through this list, for each ref update it shows only the 
commits introduced by the change that aren't already included in an existing 
ref.  This is the problem, ref2 introduced "*" and "A" and ref1 
introduced "B",  ideally then the two emails would show

 ref2 updated from O to A
   new revs: *, A
 ref1 updated from O to B
   new revs: B

But because ref1 is alphabetically before ref1, what you get is:

 ref1 updated from O to B
   new revs: *, A, B
 ref2 updated from O to A
   new revs: <none>

I can't say I know what the answer is; nor even what the correct output should 
be.  If anyone has opinions on this, I'll be glad to hear them.

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