From 1d436bec5815b52cd7d15baff18bca72c76f96c8 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Sat, 1 Jun 2013 14:50:25 -0300 Subject: [PATCH] Fixes #311 --- src/GitList/Git/Client.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/GitList/Git/Client.php b/src/GitList/Git/Client.php index 88bf508..1547d53 100644 --- a/src/GitList/Git/Client.php +++ b/src/GitList/Git/Client.php @@ -50,7 +50,7 @@ class Client extends BaseClient return $allRepositories; } - private function recurseDirectory($path) + private function recurseDirectory($path, $topLevel = true) { $dir = new \DirectoryIterator($path); @@ -90,10 +90,21 @@ class Client extends BaseClient $description = null; } - $repositories[$file->getFilename()] = array('name' => $file->getFilename(), 'path' => $file->getPathname(), 'description' => $description); + if (!$topLevel) { + $repoName = $file->getPathInfo()->getFilename() . '/' . $file->getFilename(); + } else { + $repoName = $file->getFilename(); + } + + $repositories[$repoName] = array( + 'name' => $repoName, + 'path' => $file->getPathname(), + 'description' => $description + ); + continue; } else { - $repositories = array_merge($repositories, $this->recurseDirectory($file->getPathname())); + $repositories = array_merge($repositories, $this->recurseDirectory($file->getPathname(), false)); } } }