[PHP-CVS] [git] commit karma.git: hooks/post-receive.mail lib/Git/PostReceiveHook.php

2012-03-20 Thread Derick Rethans
Commit: eb514083bf2a6ddaa0f2404da3d4347d2747a22e
Author: Derick Rethans(git...@derickrethans.nl) Tue, 20 Mar 2012 
07:50:06 +
Committer: Derick Rethans(git...@derickrethans.nl)  Tue, 20 Mar 2012 
07:54:58 +
Parents: 42d233ae4752adbce2709553cef0cd456b92a2e0

Link: 
http://git.php.net/?p=karma.git;a=commitdiff;h=eb514083bf2a6ddaa0f2404da3d4347d2747a22e

Log:
Don't use an email prefix unless specifically configured.

This gets rid of the superfluous "[git] " in every mail subject to PHP-CVS.

Changed paths:
  M  hooks/post-receive.mail
  M  lib/Git/PostReceiveHook.php


Diff:
eb514083bf2a6ddaa0f2404da3d4347d2747a22e
diff --git a/hooks/post-receive.mail b/hooks/post-receive.mail
index 7d47619..de24b77 100755
--- a/hooks/post-receive.mail
+++ b/hooks/post-receive.mail
@@ -30,7 +30,10 @@ include 'Git/PostReceiveHook.php';
 
 
 $recipients = exec('git config hooks.mailinglist');
-$emailPrefix = exec('git config hooks.emailprefix') ?: '[git]';
+$emailPrefix = exec('git config hooks.emailprefix');
+if ($emailprefix != '') {
+   $emailprefix . ' ';
+}
 
 $user = null;
 if (getenv('REMOTE_USER')) {
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index bd3be9b..4aec7b7 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -229,7 +229,7 @@ class PostReceiveHook extends ReceiveHook
 
 
 $mail = new \Mail();
-$mail->setSubject($this->emailPrefix . ' branch ' . 
$this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . 
$shortname);
+$mail->setSubject($this->emailPrefix . 'branch ' . 
$this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . 
$shortname);
 
 $message = 'Branch ' . $shortname . ' in ' . 
$this->getRepositoryName() . ' was ' . $status[$changeType] . 'd' . "\n";
 $message .= 'Date: ' . date('r') . "\n";
@@ -567,7 +567,7 @@ class PostReceiveHook extends ReceiveHook
 $diff =  \Git::gitExec('diff-tree -c -p %s', 
escapeshellarg($revision));
 
 $mail = new \Mail();
-$mail->setSubject($this->emailPrefix . ' commit ' . 
$this->getRepositoryName() . ': ' . implode(' ', array_keys($paths)));
+$mail->setSubject($this->emailPrefix . 'commit ' . 
$this->getRepositoryName() . ': ' . implode(' ', array_keys($paths)));
 
 $message = '';


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] [git] commit karma.git: hooks/post-receive.mail

2012-03-19 Thread David Soria Parra
Commit: dbda495a2985d4447f629bf50adbae16ee518dc3
Author: David Soria Parra(d...@php.net) Mon, 19 Mar 2012 16:17:23 +0100
Committer: David Soria Parra(d...@php.net)  Mon, 19 Mar 2012 16:17:23 +0100
Parents: efd58e9da03931adc336fbf3400a94d4103f5fbf

Link: 
http://git.php.net/?p=karma.git;a=commitdiff;h=dbda495a2985d4447f629bf50adbae16ee518dc3

Log:
Do not send mails when we have no receipients

Changed paths:
  M  hooks/post-receive.mail


Diff:
dbda495a2985d4447f629bf50adbae16ee518dc3
diff --git a/hooks/post-receive.mail b/hooks/post-receive.mail
index 8814b35..7d47619 100755
--- a/hooks/post-receive.mail
+++ b/hooks/post-receive.mail
@@ -40,11 +40,13 @@ if (getenv('REMOTE_USER')) {
 $user = getenv('GL_USER');
 }
 
-$hook = new \Git\PostReceiveHook(
-getenv('GL_REPO_BASE_ABS') ?: REPOSITORY_PATH,
-$user,
-getenv('USERS_DB_FILE') ?: USERS_DB_FILE,
-$recipients,
-$emailPrefix
-);
-$hook->process();
\ No newline at end of file
+if (!empty($recipients)) {
+$hook = new \Git\PostReceiveHook(
+getenv('GL_REPO_BASE_ABS') ?: REPOSITORY_PATH,
+$user,
+getenv('USERS_DB_FILE') ?: USERS_DB_FILE,
+$recipients,
+$emailPrefix
+);
+$hook->process();
+}



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php