Skip to content

Commit

Permalink
Add option hooks.diffopts to customize change summary in post-receive…
Browse files Browse the repository at this point in the history
…-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>
  • Loading branch information
Jon Jensen authored and Junio C Hamano committed Aug 4, 2011
1 parent 6a319e3 commit 0d7c01c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contrib/hooks/post-receive-email
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
# email body. If not specified, there is no limit.
# Lines beyond the limit are suppressed and counted, and a final
# line is added indicating the number of suppressed lines.
# hooks.diffopts
# Alternate options for the git diff-tree invocation that shows changes.
# Default is "--stat --summary --find-copies-harder". Add -p to those
# options to include a unified diff of changes in addition to the usual
# summary output.
#
# Notes
# -----
Expand Down Expand Up @@ -446,7 +451,7 @@ generate_update_branch_email()
# non-fast-forward updates.
echo ""
echo "Summary of changes:"
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
git diff-tree $diffopts $oldrev..$newrev
}

#
Expand Down Expand Up @@ -723,6 +728,8 @@ envelopesender=$(git config hooks.envelopesender)
emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
custom_showrev=$(git config hooks.showrev)
maxlines=$(git config hooks.emailmaxlines)
diffopts=$(git config hooks.diffopts)
: ${diffopts:="--stat --summary --find-copies-harder"}

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

0 comments on commit 0d7c01c

Please sign in to comment.