Git development
 help / color / mirror / Atom feed
* [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients
@ 2008-11-12 16:21 Michael Adam
  2008-11-12 17:49 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Adam @ 2008-11-12 16:21 UTC (permalink / raw)
  To: git; +Cc: Andy Parkins, Junio C Hamano, Michael Adam

This changes the behaviour of post-receive-email when a list of recipients
(separated by commas) is specified as hooks.mailinglist. With this modification,
an individual mail is sent out for each recipient entry in the list, instead
of sending a single mail with all the recipients in the "To: " field.

Signed-off-by: Michael Adam <obnox@samba.org>
---
 contrib/hooks/post-receive-email |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 28a3c0e..5deaf28 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -169,21 +169,25 @@ generate_email()
 		describe=$rev
 	fi
 
-	generate_email_header
+	# loop over the recipients to send individual mails
+	echo $recipients | sed -e 's/\s*,\s*/\n/' | while read recipient
+	do
+		generate_email_header
 
-	# Call the correct body generation function
-	fn_name=general
-	case "$refname_type" in
-	"tracking branch"|branch)
-		fn_name=branch
-		;;
-	"annotated tag")
-		fn_name=atag
-		;;
-	esac
-	generate_${change_type}_${fn_name}_email
+		# Call the correct body generation function
+		fn_name=general
+		case "$refname_type" in
+		"tracking branch"|branch)
+			fn_name=branch
+			;;
+		"annotated tag")
+			fn_name=atag
+			;;
+		esac
+		generate_${change_type}_${fn_name}_email
 
-	generate_email_footer
+		generate_email_footer
+	done
 }
 
 generate_email_header()
-- 
1.5.6

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

* Re: [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients
  2008-11-12 16:21 [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients Michael Adam
@ 2008-11-12 17:49 ` Junio C Hamano
  2008-11-12 17:58   ` Michael Adam
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-11-12 17:49 UTC (permalink / raw)
  To: Michael Adam; +Cc: git, Andy Parkins

Michael Adam <obnox@samba.org> writes:

> This changes the behaviour of post-receive-email when a list of recipients
> (separated by commas) is specified as hooks.mailinglist. With this modification,
> an individual mail is sent out for each recipient entry in the list, instead
> of sending a single mail with all the recipients in the "To: " field.

Why can that be an improvement?

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

* Re: [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients
  2008-11-12 17:49 ` Junio C Hamano
@ 2008-11-12 17:58   ` Michael Adam
  2008-11-12 18:18     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Adam @ 2008-11-12 17:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Michael Adam, git, Andy Parkins

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

Junio C Hamano wrote:
> Michael Adam <obnox@samba.org> writes:
> 
> > This changes the behaviour of post-receive-email when a list of recipients
> > (separated by commas) is specified as hooks.mailinglist. With this modification,
> > an individual mail is sent out for each recipient entry in the list, instead
> > of sending a single mail with all the recipients in the "To: " field.
> 
> Why can that be an improvement?

My use case is that I have a repository where I want to send
commit messages to an "official" mailing list and to a private
recipient list that might not want to be seen on the official
mailing list.

If this is not generally useful, I could make it optional or
add s/th like a secondary mailing list argument to hooks.

Cheers - Michael


[-- Attachment #2: Type: application/pgp-signature, Size: 206 bytes --]

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

* Re: [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients
  2008-11-12 17:58   ` Michael Adam
@ 2008-11-12 18:18     ` Junio C Hamano
  2008-11-12 22:21       ` Michael Adam
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-11-12 18:18 UTC (permalink / raw)
  To: Michael Adam; +Cc: git, Andy Parkins

Michael Adam <obnox@samba.org> writes:

> Junio C Hamano wrote:
>> Michael Adam <obnox@samba.org> writes:
>> 
>> > This changes the behaviour of post-receive-email when a list of recipients
>> > (separated by commas) is specified as hooks.mailinglist. With this modification,
>> > an individual mail is sent out for each recipient entry in the list, instead
>> > of sending a single mail with all the recipients in the "To: " field.
>> 
>> Why can that be an improvement?
>
> My use case is that I have a repository where I want to send
> commit messages to an "official" mailing list and to a private
> recipient list that might not want to be seen on the official
> mailing list.

Ah.  What you want is a capability to add Bcc:, not a misfeature to run
the log formatter repeatedly wasting cycles only to generate the same
message contents.

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

* Re: [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients
  2008-11-12 18:18     ` Junio C Hamano
@ 2008-11-12 22:21       ` Michael Adam
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Adam @ 2008-11-12 22:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Andy Parkins

Junio C Hamano wrote:
> Michael Adam <obnox@samba.org> writes:
> 
> > Junio C Hamano wrote:
> >> Michael Adam <obnox@samba.org> writes:
> >> 
> >> > This changes the behaviour of post-receive-email when a list of recipients
> >> > (separated by commas) is specified as hooks.mailinglist. With this modification,
> >> > an individual mail is sent out for each recipient entry in the list, instead
> >> > of sending a single mail with all the recipients in the "To: " field.
> >> 
> >> Why can that be an improvement?
> >
> > My use case is that I have a repository where I want to send
> > commit messages to an "official" mailing list and to a private
> > recipient list that might not want to be seen on the official
> > mailing list.
> 
> Ah.  What you want is a capability to add Bcc:, not a misfeature to run
> the log formatter repeatedly wasting cycles only to generate the same
> message contents.

The intent was to send out the mail not to a (large) list of
individual recipients but to some (few) mailing lists separately.
A Bcc would be a partial solution. I also thought about that, but
I did not like it since it might make those recipients in the bcc
field feel strange because they seem to be getting mail from a
list they might not be subscribed to. Group-replying to such
mails may also cause confusion...

Of course my patch could be optimized for not wasting cycles by
only running generate_email_header() multiple times and caching
the results of the log formatter and generate_email_footer().

But I understand that my problem is a very specific one and that
generally no benefit but only disadvantage is seen in the
modification I suggested.  --  Sorry for the noise. :-)

Cheers - Michael

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

end of thread, other threads:[~2008-11-12 22:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 16:21 [PATCH] contrib/hooks/post-receive-email: send individual mails to recipients Michael Adam
2008-11-12 17:49 ` Junio C Hamano
2008-11-12 17:58   ` Michael Adam
2008-11-12 18:18     ` Junio C Hamano
2008-11-12 22:21       ` Michael Adam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox