Add option hooks.diffopts to customize change summary in post-receive-email

This makes it easy to customize the git diff-tree options, for example to include -p to include inline diffs. It defaults to the current options "--stat --summary --find-copies-harder" and thus is backward-compatible. Signed-off-by: Jon Jensen <jon@endpoint.com> Improved-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jon Jensen committed Aug 3, 2011 at 21:36 UTC 0d7c01c991f2a783cc9cd89c050254ca1eb00213
1 file changed +8 -1
contrib/hooks/post-receive-email
+8 -1
@@ -60,6 +60,11 @@
60 # email body. If not specified, there is no limit.
61 # Lines beyond the limit are suppressed and counted, and a final
62 # line is added indicating the number of suppressed lines.
63 +# hooks.diffopts
64 +# Alternate options for the git diff-tree invocation that shows changes.
65 +# Default is "--stat --summary --find-copies-harder". Add -p to those
66 +# options to include a unified diff of changes in addition to the usual
67 +# summary output.
68 #
69 # Notes
70 # -----
@@ -446,7 +451,7 @@ generate_update_branch_email()
451 # non-fast-forward updates.
452 echo ""
453 echo "Summary of changes:"
449 - git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
454 + git diff-tree $diffopts $oldrev..$newrev
455 }
456
457 #
@@ -723,6 +728,8 @@ envelopesender=$(git config hooks.envelopesender)
728 emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
729 custom_showrev=$(git config hooks.showrev)
730 maxlines=$(git config hooks.emailmaxlines)
731 +diffopts=$(git config hooks.diffopts)
732 +: ${diffopts:="--stat --summary --find-copies-harder"}
733
734 # --- Main loop
735 # Allow dual mode: run from the command line just like the update hook, or