Skip to content

Commit

Permalink
contrib/hooks/post-receive-email: make subject prefix configurable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gerrit Pape authored and Junio C Hamano committed Nov 8, 2007
1 parent 15a2f53 commit e7509ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contrib/hooks/post-receive-email
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
# hooks.envelopesender
# If set then the -f option is passed to sendmail to allow the envelope
# sender address to be set
# hooks.emailprefix
# All emails have their subjects prefixed with this prefix, or "[SCM]"
# if emailprefix is unset, to aid filtering
#
# Notes
# -----
# All emails have their subjects prefixed with "[SCM]" to aid filtering.
# All emails include the headers "X-Git-Refname", "X-Git-Oldrev",
# "X-Git-Newrev", and "X-Git-Reftype" to enable fine tuned filtering and
# give information for debugging.
Expand Down Expand Up @@ -188,7 +190,7 @@ generate_email_header()
# Generate header
cat <<-EOF
To: $recipients
Subject: ${EMAILPREFIX}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
X-Git-Refname: $refname
X-Git-Reftype: $refname_type
X-Git-Oldrev: $oldrev
Expand Down Expand Up @@ -604,7 +606,6 @@ send_mail()
# ---------------------------- main()

# --- Constants
EMAILPREFIX="[SCM] "
LOGBEGIN="- Log -----------------------------------------------------------------"
LOGEND="-----------------------------------------------------------------------"

Expand All @@ -628,6 +629,7 @@ fi
recipients=$(git repo-config hooks.mailinglist)
announcerecipients=$(git repo-config hooks.announcelist)
envelopesender=$(git-repo-config hooks.envelopesender)
emailprefix=$(git-repo-config hooks.emailprefix || echo '[SCM] ')

# --- Main loop
# Allow dual mode: run from the command line just like the update hook, or
Expand Down

0 comments on commit e7509ee

Please sign in to comment.