X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/52de444faa10f37c4174e9fe2c75e77484342549..6bde4b82ec04ee5a1622220663bcacca2ec301d6:/src/phorkie/Forker.php diff --git a/src/phorkie/Forker.php b/src/phorkie/Forker.php index f4901ed..f293455 100644 --- a/src/phorkie/Forker.php +++ b/src/phorkie/Forker.php @@ -7,6 +7,7 @@ class Forker { $new = $this->fork($repo->gitDir); \copy($repo->gitDir . '/description', $new->gitDir . '/description'); + $this->index($new); return $new; } @@ -17,6 +18,7 @@ class Forker $new->gitDir . '/description', 'Fork of ' . $originalUrl ); + $this->index($new); return $new; } @@ -26,19 +28,31 @@ class Forker $rs = new Repositories(); $new = $rs->createNew(); $vc = $new->getVc(); - \rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not + + //VersionControl_Git wants an existing dir, git clone not + \rmdir($new->gitDir); + $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( + $GLOBALS['phorkie']['cfg']['gitdir'] . '/' . $new->id . '.git' + ) ->addArgument($pathOrUrl) ->addArgument($new->workDir) ->execute(); foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) { \unlink($hookfile); } + return $new; } + + protected function index($repo) + { + $db = new Database(); + $db->getIndexer()->addRepo($repo); + } } ?>