From a76e8f858e938cd8ea0886fe49ec238ea4fc6b8b Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 7 Jun 2012 01:15:53 -0300 Subject: [PATCH] Treat non-existing description file on repositories, fixes #41 --- lib/Git/Client.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Git/Client.php b/lib/Git/Client.php index 960f5d6..f24057b 100644 --- a/lib/Git/Client.php +++ b/lib/Git/Client.php @@ -81,9 +81,15 @@ class Client if ($file->isDir() && $isRepository || $isBare) { if ($isBare) { - $description = file_get_contents($file->getPathname() . '/description'); + $description = $file->getPathname() . '/description'; } else { - $description = file_get_contents($file->getPathname() . '/.git/description'); + $description = $file->getPathname() . '/.git/description'; + } + + if (file_exists($description)) { + $description = file_get_contents($description); + } else { + $description = 'There is no repository description file. Please, create one to remove this message.'; } $repositories[] = array('name' => $file->getFilename(), 'path' => $file->getPathname(), 'description' => $description);