git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] contrib/hooks/post-receive-email: send individual mails to recipients
@ 2008-11-12 16:50 Michael Adam
  2008-11-12 17:08 ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Adam @ 2008-11-12 16:50 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>
---
Sorry, in the first version of the patch, I forgot to
adapt the generate_email_header() function fill the "To"
field only with "$recipient" instad of "$recipients".

Cheers - Michael

 contrib/hooks/post-receive-email |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 28a3c0e..f8bbeab 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()
@@ -191,7 +195,7 @@ generate_email_header()
 	# --- Email (all stdout will be the email)
 	# Generate header
 	cat <<-EOF
-	To: $recipients
+	To: $recipient
 	Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
 	X-Git-Refname: $refname
 	X-Git-Reftype: $refname_type
-- 
1.5.6

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

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

Michael Adam schrieb:
> 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.

I don't think this is well-behaved:

- The load multiplies for the sender (typically a repository server).

- And wouldn't each recipient get a new Message-Id? This would break
threading if further communication takes place among the recipients.

But I may be wrong on both accounts.

-- Hannes

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

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

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

Johannes Sixt wrote:
> Michael Adam schrieb:
> > 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.
> 
> I don't think this is well-behaved:
> 
> - The load multiplies for the sender (typically a repository server).

This is right.

> - And wouldn't each recipient get a new Message-Id? This would break
> threading if further communication takes place among the recipients.

My idea was that different recipients have different threading anyways.
OK, threading for multiple recipients can be conserved with group replies.
I thought that usually you specify a single mailing list as recipient.
My use case is that I have additional recipients that do not necessarily
want to be seen as recipients on the mailing list that is specified as
the primary recipient.

> But I may be wrong on both accounts.

Your concerns are surely valid.
Maybe it would be useful to make this optional?

Thanks for your comments!

Cheers - Michael

-- 
Michael Adam <ma@sernet.de>  <obnox@samba.org>
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.SerNet.DE, mailto: Info @ SerNet.DE

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

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

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

Michael Adam <obnox@samba.org> writes:

> Johannes Sixt wrote:
>> Michael Adam schrieb:
>> > 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.
>> 
>> I don't think this is well-behaved:
> ...
> Your concerns are surely valid.
> Maybe it would be useful to make this optional?

What benefit could anybody possibly get by making this optional?

If you do not want to show multiple names on To: header to the mail
recipients, there already is a well-known solution, and it is called
(surprise!) mailing list ;-)

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 16:50 [PATCH v2] contrib/hooks/post-receive-email: send individual mails to recipients Michael Adam
2008-11-12 17:08 ` Johannes Sixt
2008-11-12 17:42   ` Michael Adam
2008-11-12 18:01     ` Junio C Hamano

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 NNTP newsgroup(s).