From c27766370f41b21bd4e7b0087efc5ca55a71c3ca Mon Sep 17 00:00:00 2001
From: Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Date: Tue, 22 Jun 2010 16:26:04 +0200
Subject: [PATCH] nicer emails

---
 scripts/git-check.sh                  |  2 +-
 scripts/post-receive-email-with-diffs | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/scripts/git-check.sh b/scripts/git-check.sh
index 92fada8..c803a7b 100755
--- a/scripts/git-check.sh
+++ b/scripts/git-check.sh
@@ -64,7 +64,7 @@ function check_configs () {
 	git config hooks.mailinglist >& /dev/null || { git config hooks.mailinglist build@onelab.eu; echo -n "mailinglist "; }
         git config hooks.announcelist >& /dev/null  || { git config hooks.announcelist  build@onelab.eu; echo -n "announcelist "; }
         git config hooks.envelopesender >& /dev/null  || { git config hooks.envelopesender  build@onelab.eu; echo -n "envelopesender "; }
-        git config hooks.emailprefix >& /dev/null|| { git config hooks.emailprefix '[GIT]'; echo -n "emailprefix "; }
+        git config hooks.emailprefix >& /dev/null|| { git config hooks.emailprefix '[GIT] '; echo -n "emailprefix "; }
 	cd - >& /dev/null
     done
     echo ""
diff --git a/scripts/post-receive-email-with-diffs b/scripts/post-receive-email-with-diffs
index 064f56b..6f42e95 100755
--- a/scripts/post-receive-email-with-diffs
+++ b/scripts/post-receive-email-with-diffs
@@ -183,10 +183,19 @@ generate_email()
 generate_email_header()
 {
 	# --- Email (all stdout will be the email)
+        # optimize output for branch, master
+        local details
+        if [ "$refname_type" == branch -a "$short_refname" == master ] ; then
+	    details=""
+	else
+	    details="$refname_type, $short_refname,"
+	fi
+	local shortrev
+	shortrev=$(echo $describe | cut -b1-8)
 	# Generate header
 	cat <<-EOF
 	To: $recipients
-	Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
+	Subject: ${emailprefix}$projectdesc ${details}${change_type}d. ${shortrev}
 	X-Git-Refname: $refname
 	X-Git-Reftype: $refname_type
 	X-Git-Oldrev: $oldrev
-- 
2.47.0