git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Jensen <jon@endpoint.com>
To: git@vger.kernel.org
Cc: andyparkins@gmail.com, Jon Jensen <jon@endpoint.com>
Subject: [PATCH] Add option hooks.emaildiff to include full diff in post-receive-email.
Date: Mon, 11 Aug 2008 15:20:39 -0600	[thread overview]
Message-ID: <1218489639-21876-1-git-send-email-jon@endpoint.com> (raw)

(I forgot to sign off the first time.)

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, I added it as a
boolean config variable, hooks.emaildiff.

Signed-off-by: Jon Jensen <jon@endpoint.com>
---
 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 4136895..07351cc 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -38,6 +38,9 @@
 # hooks.emailprefix
 #   All emails have their subjects prefixed with this prefix, or "[SCM]"
 #   if emailprefix is unset, to aid filtering
+# hooks.emaildiff
+#   If set, then a full diff of changes is sent in addition to the default
+#   summary output.
 #
 # Notes
 # -----
@@ -410,8 +413,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 --find-copies-harder --stat --summary -p $oldrev..$newrev
+	else
+		echo "Summary of changes:"
+		git diff-tree --find-copies-harder --stat --summary $oldrev..$newrev
+	fi
 }
 
 #
@@ -627,6 +635,7 @@ recipients=$(git config hooks.mailinglist)
 announcerecipients=$(git config hooks.announcelist)
 envelopesender=$(git config hooks.envelopesender)
 emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
+emaildiff=$(git config hooks.emaildiff)
 
 # --- Main loop
 # Allow dual mode: run from the command line just like the update hook, or
-- 
1.6.0.rc2.2.gd827

             reply	other threads:[~2008-08-11 21:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11 21:20 Jon Jensen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-03  3:34 [PATCH] Add option hooks.emaildiff to include full diff in post-receive-email Jon Jensen
2011-08-03 18:52 ` Junio C Hamano
2008-08-11 21:01 Jon Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218489639-21876-1-git-send-email-jon@endpoint.com \
    --to=jon@endpoint.com \
    --cc=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).