Ejemplo n.º 1
0
 protected function fork($pathOrUrl)
 {
     $rs = new Repositories();
     $new = $rs->createNew();
     $vc = $new->getVc();
     //VersionControl_Git wants an existing dir, git clone not
     \rmdir($new->gitDir);
     $cmd = $vc->getCommand('clone')->addArgument('--separate-git-dir')->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git')->addArgument($pathOrUrl)->addArgument($new->workDir);
     try {
         $cmd->execute();
     } catch (\Exception $e) {
         //clean up, we've got no workdir otherwise
         $new->delete();
         throw $e;
     }
     $rs = new Repository_Setup($new);
     $rs->afterInit();
     //update info for dumb git HTTP transport
     //the post-update hook should do that IMO, but does not somehow
     $vc->getCommand('update-server-info')->execute();
     return $new;
 }
Ejemplo n.º 2
0
 public function createRepo()
 {
     $rs = new Repositories();
     $repo = $rs->createNew();
     $vc = $repo->getVc();
     $vc->getCommand('init')->addArgument('--separate-git-dir')->addArgument($GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $repo->id . '.git')->addArgument($repo->workDir)->execute();
     $rs = new Repository_Setup($repo);
     $rs->afterInit();
     return $repo;
 }