X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/f88c38723e3c807769627aff2866fc3cf5c8472f..934246267dc4089dc0952bbe8412f32fd7346739:/src/phorkie/Forker.php diff --git a/src/phorkie/Forker.php b/src/phorkie/Forker.php index f4e1295..b4ab449 100644 --- a/src/phorkie/Forker.php +++ b/src/phorkie/Forker.php @@ -6,7 +6,14 @@ class Forker public function forkLocal($repo) { $new = $this->fork($repo->gitDir); + \copy($repo->gitDir . '/description', $new->gitDir . '/description'); + $new->getVc() + ->getCommand('config') + ->addArgument('remote.origin.title') + ->addArgument(file_get_contents($repo->gitDir . '/description')) + ->execute(); + $this->index($new); $not = new Notificator(); @@ -15,13 +22,28 @@ class Forker return $new; } - public function forkRemote($cloneUrl, $originalUrl) + public function forkRemote($cloneUrl, $originalUrl, $title = null) { $new = $this->fork($cloneUrl); - file_put_contents( - $new->gitDir . '/description', - 'Fork of ' . $originalUrl - ); + + $new->getVc() + ->getCommand('config') + ->addArgument('remote.origin.title') + ->addArgument($title) + ->execute(); + if ($originalUrl != $cloneUrl) { + $new->getVc() + ->getCommand('config') + ->addArgument('remote.origin.homepage') + ->addArgument($originalUrl) + ->execute(); + } + + if ($title === null) { + $title = 'Fork of ' . $originalUrl; + } + file_put_contents($new->gitDir . '/description', $title); + $this->index($new); $not = new Notificator();