X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/2f7659becb40e457872fc45f59ad81bff439722f..cec8f61ab84122a3f4b0702aaad6f7a141f99f7b:/src/Phorkie/Repository.php diff --git a/src/Phorkie/Repository.php b/src/Phorkie/Repository.php index aeccc72..5273b60 100644 --- a/src/Phorkie/Repository.php +++ b/src/Phorkie/Repository.php @@ -82,6 +82,9 @@ class Repository if ($base != $name) { throw new Exception('No directories supported for now'); } + if ($name == '') { + throw new Exception_Input('Empty file name given'); + } $path = $this->repoDir . '/' . $base; if (!is_readable($path)) { throw new Exception_Input('File does not exist'); @@ -89,6 +92,16 @@ class Repository return new File($path, $this); } + public function hasFile($name) + { + try { + $this->getFileByName($name); + } catch (Exception $e) { + return false; + } + return true; + } + public function getDescription() { if (!is_readable($this->repoDir . '/.git/description')) { @@ -97,6 +110,11 @@ class Repository return file_get_contents($this->repoDir . '/.git/description'); } + public function setDescription($description) + { + file_put_contents($this->repoDir . '/.git/description', $description); + } + /** * Get a link to the repository *