From ee3bb228365aacb13158443474f64c01c22de3fb Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 5 Nov 2009 01:13:34 +0100 Subject: [PATCH] taskd/mail.sh: Take optional fourth parameter with project name --- Girocco/Notify.pm | 2 +- taskd/mail.sh | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Girocco/Notify.pm b/Girocco/Notify.pm index a672f15..0cbe095 100644 --- a/Girocco/Notify.pm +++ b/Girocco/Notify.pm @@ -134,7 +134,7 @@ sub ref_change { # First, possibly send out various mails if ($proj->{notifymail}) { system($Girocco::Config::basedir.'/taskd/mail.sh', - "$ref", "$oldrev", "$newrev") + "$ref", "$oldrev", "$newrev", $proj->{name}) and warn "mail.sh failed"; } diff --git a/taskd/mail.sh b/taskd/mail.sh index 27b7b17..45272e5 100755 --- a/taskd/mail.sh +++ b/taskd/mail.sh @@ -11,6 +11,8 @@ # This is Girocco-customized version. No matter what is said below, it has # following changes: # * Calling with arguments is same as giving them on stdin. +# * Optional fourth parameter is project name, used at most places instead +# of description. # ================= # # This hook is stored in the contrib/hooks directory. Your distribution @@ -202,7 +204,7 @@ generate_email_header() # Generate header cat <<-EOF To: $recipients - Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe + Subject: ${emailprefix}$projectname $refname_type, $short_refname, ${change_type}d. $describe X-Git-Refname: $refname X-Git-Reftype: $refname_type X-Git-Oldrev: $oldrev @@ -210,7 +212,7 @@ generate_email_header() This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing - the project "$projectdesc". + the project $projectname. The $refname_type, $short_refname has been ${change_type}d EOF @@ -224,7 +226,7 @@ generate_email_footer() hooks/post-receive --${SPACE} - $projectdesc + $projectboth EOF } @@ -673,6 +675,15 @@ then projectdesc="UNNAMED PROJECT" fi +projectname="$4" +if [ -n "$projectname" ]; then + projectname="$projectname.git" + projectboth="$projectname (\"$projectdesc\")" +else + projectname="$projectdesc" + projectboth="$projectdesc" +fi + recipients=$(git config hooks.mailinglist) announcerecipients=$(git config hooks.announcelist) envelopesender=$(git config hooks.envelopesender) -- 2.11.4.GIT