git.cweiske.de
/
phorkie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
check for openid package
[phorkie.git]
/
src
/
phorkie
/
Forker.php
diff --git
a/src/phorkie/Forker.php
b/src/phorkie/Forker.php
index 3425a72283eefaa2f758301be6863bc8e155a178..7473f1633aad1acf34b50c667618cf5b4772205a 100644
(file)
--- a/
src/phorkie/Forker.php
+++ b/
src/phorkie/Forker.php
@@
-7,16
+7,18
@@
class Forker
{
$new = $this->fork($repo->gitDir);
\copy($repo->gitDir . '/description', $new->gitDir . '/description');
{
$new = $this->fork($repo->gitDir);
\copy($repo->gitDir . '/description', $new->gitDir . '/description');
+ $this->index($new);
return $new;
}
return $new;
}
- public function forkRemote($
u
rl)
+ public function forkRemote($
cloneUrl, $originalU
rl)
{
{
- $new = $this->fork($
u
rl);
+ $new = $this->fork($
cloneU
rl);
file_put_contents(
$new->gitDir . '/description',
file_put_contents(
$new->gitDir . '/description',
- 'Fork of ' . $
u
rl
+ 'Fork of ' . $
originalU
rl
);
);
+ $this->index($new);
return $new;
}
return $new;
}
@@
-26,19
+28,38
@@
class Forker
$rs = new Repositories();
$new = $rs->createNew();
$vc = $new->getVc();
$rs = new Repositories();
$new = $rs->createNew();
$vc = $new->getVc();
- \rmdir($new->gitDir);//VersionControl_Git wants an existing dir, git clone not
- $vc->getCommand('clone')
+
+ //VersionControl_Git wants an existing dir, git clone not
+ \rmdir($new->gitDir);
+
+ $cmd = $vc->getCommand('clone')
//this should be setOption, but it fails with a = between name and value
->addArgument('--separate-git-dir')
//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($pathOrUrl)
- ->addArgument($new->workDir)
- ->execute();
+ ->addArgument($new->workDir);
+ try {
+ $cmd->execute();
+ } catch (\Exception $e) {
+ //clean up, we've got no workdir otherwise
+ $new->delete();
+ throw $e;
+ }
+
foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) {
\unlink($hookfile);
}
foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) {
\unlink($hookfile);
}
+
return $new;
}
return $new;
}
+
+ protected function index($repo)
+ {
+ $db = new Database();
+ $db->getIndexer()->addRepo($repo);
+ }
}
?>
}
?>