]> asedeno.scripts.mit.edu Git - git.git/blobdiff - contrib/hooks/post-receive-email
Merge branch 'jc/stash-create'
[git.git] / contrib / hooks / post-receive-email
index 9b9a977771f4f1706f0789b6fb558dece94df47c..7511ea0797286453051c15765c4b795ac577cc0d 100644 (file)
 # 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.
@@ -154,10 +156,6 @@ generate_email()
        fi
 
        # Email parameters
-       # The committer will be obtained from the latest existing rev; so
-       # for a deletion it will be the oldrev, for the others, then newrev
-       committer=$(git show --pretty=full -s $rev | sed -ne "s/^Commit: //p" |
-               sed -ne 's/\(.*\) </"\1" </p')
        # The email subject will contain the best description of the ref
        # that we can build from the parameters
        describe=$(git describe $rev 2>/dev/null)
@@ -188,7 +186,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
@@ -604,7 +602,6 @@ send_mail()
 # ---------------------------- main()
 
 # --- Constants
-EMAILPREFIX="[SCM] "
 LOGBEGIN="- Log -----------------------------------------------------------------"
 LOGEND="-----------------------------------------------------------------------"
 
@@ -628,6 +625,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