threads / discuss / 10154

Correction for post-receive-email

Subject: Correction for post-receive-email

## tl;dr

5 messages between Oct 5, 2007 and Oct 5, 2007.

replies: 4people: 4as markdown or json

Eric Mertens· Oct 5, 2007, 07:14 UTC · lore
Hello,
(My apologies if my incorrectly addressed subscribe message went to the list)

I noticed that my mutt wasn't correctly detecting the signature block on the end of the automated emails I was receiving from the script in contrib. I've made this trivial change in my local copy of the script, but I figured that if I was going to be modifying the source code I should share my changes.

-- 
Eric Mertens


From 119f84fa6f6bb33c6fc524ab4277d38bebc10468 Mon Sep 17 00:00:00 2001
From: Eric Mertens <emertens@gmail.com>
Date: Fri, 5 Oct 2007 00:06:52 -0700
Subject: [PATCH] Correct signature block delimiter in post-receive-email by adding a trailing space

This change allows mail clients like Mutt to easily detect the signature
and is consistent with the signature block article on Wikipedia.
---
 contrib/hooks/post-receive-email |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index cbbd02f..828651a 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -198,7 +198,7 @@ generate_email_footer()
 
 
 	hooks/post-receive
-	--
+	-- 
 	$projectdesc
 	EOF
 }
-- 
1.5.3.4
Andy Parkins· Oct 5, 2007, 08:13 UTC · re: Eric Mertens · lore

Re: Correction for post-receive-email

On Friday 2007 October 05, Eric Mertens wrote:
Show 5 quoted lines
> I noticed that my mutt wasn't correctly detecting the signature block
> on the end of the automated emails I was receiving from the script in
> contrib. I've made this trivial change in my local copy of the script,
> but I figured that if I was going to be modifying the source code I
> should share my changes.

That change has been in my pending queue for a while. It's technically correct, but I've never submitted it. The reason I haven't is that it adds trailing whitespace.

Perhaps one of the shell gurus can offer a nicer way of having a trailing space be output in a heredoc that doesn't add a trailing space in the source script?

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Andreas Ericsson· Oct 5, 2007, 08:54 UTC · re: Andy Parkins · lore

Re: Correction for post-receive-email

Andy Parkins wrote:
Show 16 quoted lines
> On Friday 2007 October 05, Eric Mertens wrote:
> 
>> I noticed that my mutt wasn't correctly detecting the signature block
>> on the end of the automated emails I was receiving from the script in
>> contrib. I've made this trivial change in my local copy of the script,
>> but I figured that if I was going to be modifying the source code I
>> should share my changes.
> 
> That change has been in my pending queue for a while.  It's technically 
> correct, but I've never submitted it.  The reason I haven't is that it adds 
> trailing whitespace.
> 
> Perhaps one of the shell gurus can offer a nicer way of having a trailing 
> space be output in a heredoc that doesn't add a trailing space in the source 
> script?
> 
space=' '

cat << EOF --$space EOF

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Bill Lear· Oct 5, 2007, 12:35 UTC · re: Andy Parkins · lore

Re: Correction for post-receive-email

On Friday, October 5, 2007 at 09:13:57 (+0100) Andy Parkins writes:
Show 15 quoted lines
>On Friday 2007 October 05, Eric Mertens wrote:
>
>> I noticed that my mutt wasn't correctly detecting the signature block
>> on the end of the automated emails I was receiving from the script in
>> contrib. I've made this trivial change in my local copy of the script,
>> but I figured that if I was going to be modifying the source code I
>> should share my changes.
>
>That change has been in my pending queue for a while.  It's technically 
>correct, but I've never submitted it.  The reason I haven't is that it adds 
>trailing whitespace.
>
>Perhaps one of the shell gurus can offer a nicer way of having a trailing 
>space be output in a heredoc that doesn't add a trailing space in the source 
>script?

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?

Bill
Andy Parkins· Oct 5, 2007, 14:29 UTC · re: Bill Lear · lore

Re: Correction for post-receive-email

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
andyparkins@gmail.com

← back to recent threads