DORMANTno replies

[PATCH] Add option hooks.emaildiff to include full diff in post-receive-email

From: Jon Jensen <hidden>
Date: 2016-06-15 22:51:43
Subsystem: the rest · Maintainer: Linus Torvalds

I've always found that a very important part of receiving email
notification of commits is being able to read the diff inline,
easily, where I can reply and quote the diff and make comments.
It's similar to the reason patches sent to the Git mailing list
need to be inline, not attachments.

Since post-receive-email didn't have that option, this adds it as a
boolean config variable, hooks.emaildiff.

Signed-off-by: Jon Jensen <redacted>
---
 contrib/hooks/post-receive-email |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 21989fc..5b9b26d 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -60,6 +60,9 @@
 #   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.emaildiff
+#   If set, then a full diff of changes is sent in addition to the default
+#   summary output.
 #
 # Notes
 # -----
@@ -445,8 +448,13 @@ generate_update_branch_email()
 	# - including the undoing of previous revisions in the case of
 	# non-fast-forward updates.
 	echo ""
-	echo "Summary of changes:"
-	git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
+	if [ -n "$emaildiff" ]; then
+		echo "Summary of changes and diff:"
+		git diff-tree --stat --summary --find-copies-harder -p $oldrev..$newrev
+	else
+		echo "Summary of changes:"
+		git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
+	fi
 }
 
 #
@@ -723,6 +731,7 @@ envelopesender=$(git config hooks.envelopesender)
 emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
 custom_showrev=$(git config hooks.showrev)
 maxlines=$(git config hooks.emailmaxlines)
+emaildiff=$(git config hooks.emaildiff)
 
 # --- Main loop
 # Allow dual mode: run from the command line just like the update hook, or
-- 
1.7.6.233.gd79bc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help