Treat non-existing description file on repositories, fixes #41

This commit is contained in:
Klaus Silveira
2012-06-07 01:15:53 -03:00
parent 8ac31cdc93
commit a76e8f858e

View File

@@ -81,9 +81,15 @@ class Client
if ($file->isDir() && $isRepository || $isBare) { if ($file->isDir() && $isRepository || $isBare) {
if ($isBare) { if ($isBare) {
$description = file_get_contents($file->getPathname() . '/description'); $description = $file->getPathname() . '/description';
} else { } 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); $repositories[] = array('name' => $file->getFilename(), 'path' => $file->getPathname(), 'description' => $description);