From 080aad76176bda0daef478cc1b6cd8fcbfc08112 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 14 Apr 2011 18:41:57 -0500 Subject: [PATCH] post-receive-hudson: Default USER_EMAIL to the committer's email address. Patch by Aaron Boxer. --- server/post-receive-hudson | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/post-receive-hudson b/server/post-receive-hudson index 2e2ea07..45ce301 100755 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -14,7 +14,8 @@ # Whitespace separated list of branches to not make jobs for. # USER_EMAIL # Environment variable that should be set by your repository-specific -# post-receive hook. E.g. export USER_EMAIL=${USER}@example.com +# post-receive hook. E.g. export USER_EMAIL=${USER}@example.com. If +# unset, defaults to the email by of the pushed commit. # . $(dirname $0)/functions @@ -39,6 +40,10 @@ while read oldrev newrev refname ; do exit 0 fi + if [ -z "$USER_EMAIL" ] ; then + USER_EMAIL=$(git log -1 --pretty=format:'%ce' $newrev) + fi + branch_config=$(wget -O - $hudson_url/job/${short_refname}/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then # Create the job -- 2.20.1