aboutsummaryrefslogtreecommitdiff
path: root/www/fork.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-19 23:52:07 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-19 23:52:07 +0200
commit8701af280fa5a9c83827cdd0e2ae335d2512a3a7 (patch)
treefb6acda3b21f358e5879bd843774f2257f4b4191 /www/fork.php
parente8151ad24cb9f4951ea1f29f5878248e584b8372 (diff)
downloadphorkie-8701af280fa5a9c83827cdd0e2ae335d2512a3a7.tar.gz
phorkie-8701af280fa5a9c83827cdd0e2ae335d2512a3a7.zip
move forking code to separate class
Diffstat (limited to 'www/fork.php')
-rw-r--r--www/fork.php17
1 files changed, 2 insertions, 15 deletions
diff --git a/www/fork.php b/www/fork.php
index 6c96a6a..d8a24a2 100644
--- a/www/fork.php
+++ b/www/fork.php
@@ -13,21 +13,8 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
$repo = new Repository();
$repo->loadFromRequest();
-$rs = new Repositories();
-$new = $rs->createNew();
-$vc = $new->getVc();
-\rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not
-$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($repo->gitDir)
- ->addArgument($new->workDir)
- ->execute();
-\copy($repo->gitDir . '/description', $new->gitDir . '/description');
-foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) {
- \unlink($hookfile);
-}
+$forker = new Forker();
+$new = $forker->forkLocal($repo);
//FIXME: where to put fork source link?
redirect($new->getLink('display'));