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