Skip to content

Commit 0d7c01c

Browse files
jonjensengitster
authored andcommitted
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 <[email protected]> Improved-by: Junio C Hamano <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6a319e3 commit 0d7c01c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

contrib/hooks/post-receive-email

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
# email body. If not specified, there is no limit.
6161
# Lines beyond the limit are suppressed and counted, and a final
6262
# 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.
6368
#
6469
# Notes
6570
# -----
@@ -446,7 +451,7 @@ generate_update_branch_email()
446451
# non-fast-forward updates.
447452
echo ""
448453
echo "Summary of changes:"
449-
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
454+
git diff-tree $diffopts $oldrev..$newrev
450455
}
451456

452457
#
@@ -723,6 +728,8 @@ envelopesender=$(git config hooks.envelopesender)
723728
emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
724729
custom_showrev=$(git config hooks.showrev)
725730
maxlines=$(git config hooks.emailmaxlines)
731+
diffopts=$(git config hooks.diffopts)
732+
: ${diffopts:="--stat --summary --find-copies-harder"}
726733

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

0 commit comments

Comments
 (0)