Fixed to have a simpler code.

This commit is contained in:
Loic d'Anterroches 2010-04-15 15:40:36 +02:00
parent 45fa309c07
commit 10f08386f7
2 changed files with 3 additions and 7 deletions

View File

@ -65,10 +65,8 @@ class IDF_Plugin_SyncGit
*/
static public function postUpdate($signal, &$params)
{
// Find the corresponding project.
$git_dir = substr($params['git_dir'], 0, -4); // Chop the ".git"
$elts = preg_split('#/#', $git_dir, -1, PREG_SPLIT_NO_EMPTY);
$pname = array_pop($elts);
// Chop the ".git" and get what is left
$pname = basename(substr($params['git_dir'], 0, -4));
try {
$project = IDF_Project::getOr404($pname);
} catch (Pluf_HTTP_Error404 $e) {

View File

@ -242,9 +242,7 @@ class IDF_Plugin_SyncSvn
*/
public function processSvnUpdateTimeline($params)
{
$repo_dir = $params['repo_dir'];
$elts = preg_split('#/#', $repo_dir, -1, PREG_SPLIT_NO_EMPTY);
$pname = array_pop($elts);
$pname = basename($params['repo_dir']);
try {
$project = IDF_Project::getOr404($pname);
} catch (Pluf_HTTP_Error404 $e) {