} 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);
$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();
//this should be setOption, but it fails with a = between name and value
->addArgument('--separate-git-dir')
->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git')
- ->addArgument($repo->workDir);
+ ->addArgument($repo->workDir)
->execute();
foreach (glob($repo->gitDir . '/hooks/*') as $hookfile) {