X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/2b4b34a76f42841e964a549fc64c02ba4f60a3f4..3f0ffc6181c329dd2c1ee05d220b4b82ea907e36:/www/fork.php?ds=inline diff --git a/www/fork.php b/www/fork.php index cc98df0..2832fe4 100644 --- a/www/fork.php +++ b/www/fork.php @@ -3,6 +3,7 @@ * Fork a repository */ 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 +?>