X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/a3845de282299bd805d6455789bc6531bde861be..3f0ffc6181c329dd2c1ee05d220b4b82ea907e36:/www/fork.php?ds=inline diff --git a/www/fork.php b/www/fork.php index f6ec95a..2832fe4 100644 --- a/www/fork.php +++ b/www/fork.php @@ -2,7 +2,8 @@ /** * Fork a repository */ -namespace Phorkie; +namespace phorkie; +$pageRequiresLogin = '1'; require_once 'www-header.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { @@ -14,15 +15,20 @@ $repo->loadFromRequest(); $rs = new Repositories(); $new = $rs->createNew(); -$new->getVc()->getCommand('clone') - ->addArgument($repo->repoDir) - ->addArgument($new->repoDir) +$vc = $new->getVc(); +\rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not +$vc->getCommand('clone') + //this should be setOption, but it fails with a = between name and value + ->addArgument('--separate-git-dir') + ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git') + ->addArgument($repo->gitDir) + ->addArgument($new->workDir) ->execute(); -\copy($repo->repoDir . '/.git/description', $new->repoDir . '/.git/description'); -foreach (glob($new->repoDir . '/.git/hooks/*') as $hookfile) { - unlink($hookfile); +\copy($repo->gitDir . '/description', $new->gitDir . '/description'); +foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) { + \unlink($hookfile); } //FIXME: where to put fork source link? redirect($new->getLink('display')); -?> \ No newline at end of file +?>