contrib/hooks/post-receive-email: Make revision display configurable
Add configuration option hooks.showrev, letting the user override how revisions will be shown in the commit email. Signed-off-by: Pete Harlan <pgit@pcharlan.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Harlan committed
Nov 3, 2008 at 23:19 UTC
b0a7d111732f644623253927c9ef2d4f3009e668
1 file changed
+17
-1
contrib/hooks/post-receive-email
+17
-1
@@ -38,6 +38,12 @@
38
# hooks.emailprefix
39
# All emails have their subjects prefixed with this prefix, or "[SCM]"
40
# if emailprefix is unset, to aid filtering
41
+# hooks.showrev
42
+# The shell command used to format each revision in the email, with
43
+# "%s" replaced with the commit id. Defaults to "git rev-list -1
44
+# --pretty %s", displaying the commit id, author, date and log
45
+# message. To list full patches separated by a blank line, you
46
+# could set this to "git show -C %s; echo".
47
#
48
# Notes
49
# -----
@@ -610,7 +616,16 @@ show_new_revisions()
616
fi
617
618
git rev-parse --not --branches | grep -v $(git rev-parse $refname) |
613
- git rev-list --pretty --stdin $revspec
619
+ if [ -z "$custom_showrev" ]
620
+ then
621
+ git rev-list --pretty --stdin $revspec
622
+ else
623
+ git rev-list --stdin $revspec |
624
+ while read onerev
625
+ do
626
+ eval $(printf "$custom_showrev" $onerev)
627
+ done
628
+ fi
629
}
630
631
@@ -650,6 +665,7 @@ recipients=$(git config hooks.mailinglist)
665
announcerecipients=$(git config hooks.announcelist)
666
envelopesender=$(git config hooks.envelopesender)
667
emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
668
+custom_showrev=$(git config hooks.showrev)
669
670
# --- Main loop
671
# Allow dual mode: run from the command line just like the update hook, or