4 class Repository_ConnectionInfo
10 public function __construct(Repository $repo)
13 //we need raw parsing; https://bugs.php.net/bug.php?id=68347
14 $this->arConfig = parse_ini_file(
15 $this->repo->gitDir . '/config', true, INI_SCANNER_RAW
19 public function isFork()
21 return $this->getOrigin() !== null;
24 public function hasForks()
26 return count($this->getForks()) > 0;
30 public function getOrigin()
32 return $this->getRemote('origin');
36 * @return Repository_Remote|null NULL if the remote does not exist, array
37 * with repository information otherwise
39 public function getRemote($name)
41 if (!isset($this->arConfig['remote "' . $name . '"'])) {
44 return new Repository_Remote($name, $this->arConfig['remote "' . $name . '"']);
47 public function getForks()
50 foreach ($this->arConfig as $name => $data) {
51 if (substr($name, 0, 13) != 'remote "fork-') {
54 $arForks[substr($name, 8, -1)] = new Repository_Remote(
55 substr($name, 8, -1), $data