git.cweiske.de
/
phorkie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
editing works basically
[phorkie.git]
/
src
/
Phorkie
/
Repository.php
diff --git
a/src/Phorkie/Repository.php
b/src/Phorkie/Repository.php
index aeccc72f826107a2465a4a9d4023490bc6b83175..5273b60a99d5105dab3f1eb22e319304f915b7ed 100644
(file)
--- 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 ($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');
$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);
}
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')) {
public function getDescription()
{
if (!is_readable($this->repoDir . '/.git/description')) {
@@
-97,6
+110,11
@@
class Repository
return file_get_contents($this->repoDir . '/.git/description');
}
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
*
/**
* Get a link to the repository
*