X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/2b4b34a76f42841e964a549fc64c02ba4f60a3f4..cdc99846c94bacdd7a2a0681d77bac3de45c4f2a:/src/phorkie/Repository/Post.php diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 627aa1f..1b60752 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -44,6 +44,7 @@ class Repository_Post } $bNew = false; + $bDelete = false; if (!isset($orignalName) || $orignalName == '') { //new file $bNew = true; @@ -51,6 +52,8 @@ class Repository_Post //unknown file //FIXME: Show error message continue; + } else if (isset($arFile['delete']) && $arFile['delete'] == 1) { + $bDelete = true; } else if ($orignalName != $name) { //FIXME: what to do with overwrites? $vc->getCommand('mv') @@ -61,7 +64,12 @@ class Repository_Post } $file = $this->repo->getFileByName($name, false); - if ($bNew || $file->getContent() != $arFile['content']) { + if ($bDelete) { + $command = $vc->getCommand('rm') + ->addArgument($file->getFilename()) + ->execute(); + $bChanged = true; + } else if ($bNew || $file->getContent() != $arFile['content']) { file_put_contents($file->getPath(), $arFile['content']); $command = $vc->getCommand('add') ->addArgument($file->getFilename()) @@ -87,9 +95,13 @@ class Repository_Post $repo = $rs->createNew(); $vc = $repo->getVc(); $vc->initRepository(); + foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) { unlink($hookfile); } + + touch($repo->repoDir . '/.git/git-daemon-export-ok'); + return $repo; }