X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/1c14a6bfb93c914374a6b2f96aec971f8c5b3053..39bd200baed00b5b63cc62ce947ef708710ac81c:/src/phorkie/Repository/Post.php diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 6ff8df6..96e5c11 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -67,12 +67,17 @@ class Repository_Post } else if (isset($arFile['delete']) && $arFile['delete'] == 1) { $bDelete = true; } else if ($orignalName != $name) { - //FIXME: what to do with overwrites? - $vc->getCommand('mv') - ->addArgument($orignalName) - ->addArgument($name) - ->execute(); - $bChanged = true; + if (strpos($name, '/') === false) { + //ignore names with a slash in it, would be new directory + //FIXME: what to do with overwrites? + $vc->getCommand('mv') + ->addArgument($orignalName) + ->addArgument($name) + ->execute(); + $bChanged = true; + } else { + $name = $orignalName; + } } $file = $this->repo->getFileByName($name, false); @@ -83,14 +88,14 @@ class Repository_Post $bChanged = true; } else if ($bUpload) { move_uploaded_file( - $_FILES['files']['tmp_name'][$num]['upload'], $file->getPath() + $_FILES['files']['tmp_name'][$num]['upload'], $file->getFullPath() ); $command = $vc->getCommand('add') ->addArgument($file->getFilename()) ->execute(); $bChanged = true; - } else if ($bNew || $file->getContent() != $arFile['content']) { - file_put_contents($file->getPath(), $arFile['content']); + } else if ($bNew || (isset($arFile['content']) && $file->getContent() != $arFile['content'])) { + file_put_contents($file->getFullPath(), $arFile['content']); $command = $vc->getCommand('add') ->addArgument($file->getFilename()) ->execute(); @@ -114,11 +119,10 @@ class Repository_Post $rs = new Repositories(); $repo = $rs->createNew(); $vc = $repo->getVc(); - //$vc->initRepository(); $vc->getCommand('init') //this should be setOption, but it fails with a = between name and value ->addArgument('--separate-git-dir') - ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id) + ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git') ->addArgument($repo->workDir) ->execute();