All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] contrib/hooks/post-receive-email: Make revision display configurable
@ 2008-11-02 23:20 Pete Harlan
  2008-11-02 23:24 ` Pete Harlan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pete Harlan @ 2008-11-02 23:20 UTC (permalink / raw)
  To: Andy Parkins, git; +Cc: Pete Harlan

Add configuration option hooks.showrev, letting the user override how
revisions will be shown in the commit email.

Signed-off-by: Pete Harlan <pgit@pcharlan.com>
---

This allows, for example, to show full diffs in the post-receive email
to simply after-the-fact reviewing of commits.  Perhaps others would
find this useful also.

 contrib/hooks/post-receive-email |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 4136895..a365c3f 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -38,6 +38,12 @@
 # hooks.emailprefix
 #   All emails have their subjects prefixed with this prefix, or "[SCM]"
 #   if emailprefix is unset, to aid filtering
+# hooks.showrev
+#   The shell command used to format each revision in the email, with
+#   "%s" replaced with the commit id.  Defaults to "git rev-list -1
+#   --pretty %s", displaying the commit id, author, date and log
+#   message.  To list full patches separated by a blank line, you
+#   could set this to "git show -C %s; echo".
 #
 # Notes
 # -----
@@ -390,8 +396,13 @@ generate_update_branch_email()
 
 		echo ""
 		echo $LOGBEGIN
-		git rev-parse --not --branches | grep -v $(git rev-parse $refname) |
-		git rev-list --pretty --stdin $oldrev..$newrev
+		git rev-parse --not --branches |
+			grep -v $(git rev-parse $refname) |
+			git rev-list --stdin $oldrev..$newrev |
+		while read onerev
+		do
+			eval $(printf "$showrev" $onerev)
+		done
 
 		# XXX: Need a way of detecting whether git rev-list actually
 		# outputted anything, so that we can issue a "no new
@@ -627,6 +638,7 @@ recipients=$(git config hooks.mailinglist)
 announcerecipients=$(git config hooks.announcelist)
 envelopesender=$(git config hooks.envelopesender)
 emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
+showrev=$(git config hooks.showrev || echo 'git rev-list -1 --pretty %s')
 
 # --- Main loop
 # Allow dual mode: run from the command line just like the update hook, or
-- 
1.6.0.3.533.ge0502

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-04  0:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-02 23:20 [PATCH] contrib/hooks/post-receive-email: Make revision display configurable Pete Harlan
2008-11-02 23:24 ` Pete Harlan
2008-11-03  9:49   ` Pete Harlan
2008-11-03 18:58 ` Andy Parkins
2008-11-03 23:34 ` Junio C Hamano
2008-11-04  0:45   ` Pete Harlan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.