6 public function forkLocal($repo)
8 $new = $this->fork($repo->gitDir);
10 \copy($repo->gitDir . '/description', $new->gitDir . '/description');
12 ->getCommand('config')
13 ->addArgument('remote.origin.title')
14 ->addArgument(file_get_contents($repo->gitDir . '/description'))
19 $not = new Notificator();
25 public function forkRemote($cloneUrl, $originalUrl, $title = null)
27 $new = $this->fork($cloneUrl);
30 ->getCommand('config')
31 ->addArgument('remote.origin.title')
34 if ($originalUrl != $cloneUrl) {
36 ->getCommand('config')
37 ->addArgument('remote.origin.homepage')
38 ->addArgument($originalUrl)
42 if ($title === null) {
43 $title = 'Fork of ' . $originalUrl;
45 file_put_contents($new->gitDir . '/description', $title);
49 $not = new Notificator();
56 protected function fork($pathOrUrl)
58 $rs = new Repositories();
59 $new = $rs->createNew();
62 //VersionControl_Git wants an existing dir, git clone not
65 $cmd = $vc->getCommand('clone')
66 //this should be setOption, but it fails with a = between name and value
67 ->addArgument('--separate-git-dir')
69 $GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git'
71 ->addArgument($pathOrUrl)
72 ->addArgument($new->workDir);
75 } catch (\Exception $e) {
76 //clean up, we've got no workdir otherwise
81 $rs = new Repository_Setup($new);
87 protected function index($repo)
90 $db->getIndexer()->addRepo($repo);