Commit: 6d6e9738bca87657c5f8bffc1a90b1dcefa57b9a
Author: Derick Rethans(git...@derickrethans.nl)         Tue, 20 Mar 2012 
08:46:33 +0000
Committer: Derick Rethans(git...@derickrethans.nl)      Tue, 20 Mar 2012 
08:47:54 +0000
Parents: 80086eabcfb6ca1d83c09c66657ce05d1a3c9125

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

Log:
Switch to getRepositoryShortName otherwise it breaks the karma system.

Changed paths:
  M  lib/Git/PostReceiveHook.php
  M  lib/Git/ReceiveHook.php


Diff:
6d6e9738bca87657c5f8bffc1a90b1dcefa57b9a
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index 4201508..209565c 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -162,7 +162,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->getRepositoryShortName() . ': ' . $status[$changeType] . ' branch ' . 
$shortname);
 
         $message = 'Branch ' . $shortname . ' in ' . 
$this->getRepositoryName() . ' was ' . $status[$changeType] . 'd' . "\n";
         $message .= 'Date: ' . date('r') . "\n";
@@ -257,7 +257,7 @@ class PostReceiveHook extends ReceiveHook
         $status = [self::TYPE_UPDATED => 'update', self::TYPE_CREATED => 
'create', self::TYPE_DELETED => 'delete'];
         $shortname = str_replace('refs/tags/', '', $name);
         $mail = new \Mail();
-        $mail->setSubject($this->emailPrefix . 'tag ' . 
$this->getRepositoryName() . ': ' . $status[$changeType] . ' tag ' . 
$shortname);
+        $mail->setSubject($this->emailPrefix . 'tag ' . 
$this->getRepositoryShortName() . ': ' . $status[$changeType] . ' tag ' . 
$shortname);
 
         $message = 'Tag ' . $shortname . ' in ' . $this->getRepositoryName() . 
' was ' . $status[$changeType] . 'd' .
             (($changeType != self::TYPE_CREATED) ? ' from ' . $oldrev : '' ) . 
"\n";
@@ -500,7 +500,7 @@ class PostReceiveHook extends ReceiveHook
         $diff =  \Git::gitExec('diff-tree -c -p %s', 
escapeshellarg($revision));
 
         $mail = new \Mail();
-        $mail->setSubject($this->emailPrefix . 'com ' . 
$this->getRepositoryName() . ': ' . $info['subject'] . ': '. implode(' ', 
array_keys($paths)));
+        $mail->setSubject($this->emailPrefix . 'com ' . 
$this->getRepositoryShortName() . ': ' . $info['subject'] . ': '. implode(' ', 
array_keys($paths)));
 
         $message = '';
 
diff --git a/lib/Git/ReceiveHook.php b/lib/Git/ReceiveHook.php
index b526e9a..d7df7b8 100644
--- a/lib/Git/ReceiveHook.php
+++ b/lib/Git/ReceiveHook.php
@@ -40,8 +40,7 @@ abstract class ReceiveHook
     /**
      * Returns the repository name.
      *
-     * A repository name is the path to the repository without the .git.
-     * e.g. php-src.git -> php-src
+     * A repository name is the path to the repository with the .git.
      *
      * @return string
      */
@@ -51,6 +50,19 @@ abstract class ReceiveHook
     }
 
     /**
+     * Returns the short repository name.
+     *
+     * A short repository name is the path to the repository without the .git.
+     * e.g. php-src.git -> php-src
+     *
+     * @return string
+     */
+    public function getRepositoryShortName()
+    {
+        return preg_replace('@\.git$@', '', $this->repositoryName);
+    }
+
+    /**
      * Return array with changed paths as keys and change type as values
      * If commit is merge commit change type will have more than one char
      * (for example "MM")


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

Reply via email to