@matheusbsbs / matheus-bagliano / commits / e7509ee388
Fork 0

contrib/hooks/post-receive-email: make subject prefix configurable

Email subjects are prefixed with "[SCM] " by default, make this optionally configurable through the hooks.emailprefix config option. Suggested by martin f krafft through http://bugs.debian.org/428418 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Gerrit Pape committed Nov 6, 2007 at 13:49 UTC e7509ee388480046a685f885431291f484de66de
1 file changed +5 -3
contrib/hooks/post-receive-email
+5 -3
@@ -35,10 +35,12 @@
35 # hooks.envelopesender
36 # If set then the -f option is passed to sendmail to allow the envelope
37 # sender address to be set
38 +# hooks.emailprefix
39 +# All emails have their subjects prefixed with this prefix, or "[SCM]"
40 +# if emailprefix is unset, to aid filtering
41 #
42 # Notes
43 # -----
41 -# All emails have their subjects prefixed with "[SCM]" to aid filtering.
44 # All emails include the headers "X-Git-Refname", "X-Git-Oldrev",
45 # "X-Git-Newrev", and "X-Git-Reftype" to enable fine tuned filtering and
46 # give information for debugging.
@@ -188,7 +190,7 @@ generate_email_header()
190 # Generate header
191 cat <<-EOF
192 To: $recipients
191 - Subject: ${EMAILPREFIX}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
193 + Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
194 X-Git-Refname: $refname
195 X-Git-Reftype: $refname_type
196 X-Git-Oldrev: $oldrev
@@ -604,7 +606,6 @@ send_mail()
606 # ---------------------------- main()
607
608 # --- Constants
607 -EMAILPREFIX="[SCM] "
609 LOGBEGIN="- Log -----------------------------------------------------------------"
610 LOGEND="-----------------------------------------------------------------------"
611
@@ -628,6 +629,7 @@ fi
629 recipients=$(git repo-config hooks.mailinglist)
630 announcerecipients=$(git repo-config hooks.announcelist)
631 envelopesender=$(git-repo-config hooks.envelopesender)
632 +emailprefix=$(git-repo-config hooks.emailprefix || echo '[SCM] ')
633
634 # --- Main loop
635 # Allow dual mode: run from the command line just like the update hook, or