6 require_once 'www-header.php';
8 if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
9 throw new Exception_Input('Forking only possible via POST');
12 $repo = new Repository();
13 $repo->loadFromRequest();
15 $rs = new Repositories();
16 $new = $rs->createNew();
18 \rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not
19 $vc->getCommand('clone')
20 //this should be setOption, but it fails with a = between name and value
21 ->addArgument('--separate-git-dir')
22 ->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git')
23 ->addArgument($repo->gitDir)
24 ->addArgument($new->workDir)
26 \copy($repo->gitDir . '/description', $new->gitDir . '/description');
27 foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) {
31 //FIXME: where to put fork source link?
32 redirect($new->getLink('display'));