public function testRevParseIsBare() { $this->initRepository(null, 0); $repo = $this->getRepository(0); $repo->init(); $options = array(RevParseCommand::OPTION_IS_BARE_REPOSIORY); $c = RevParseCommand::getInstance()->revParse(null, $options); $caller = $repo->getCaller(); $caller->execute($c); $this->assertEquals(array('false'), $caller->getOutputLines(true)); $this->initRepository(null, 1); $repo = $this->getRepository(1); $repo->init(true); $caller = $repo->getCaller(); $caller->execute($c); $this->assertEquals(array('true'), $caller->getOutputLines(true)); }
/** * rev-parse command - often used to return a commit tag. * * @param array $options the options to apply to rev-parse * * @throws \RuntimeException * @throws \InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return array */ public function revParse(array $options = array()) { $c = RevParseCommand::getInstance()->revParse($this, $options); $caller = $this->repository->getCaller(); $caller->execute($c); return array_map('trim', $caller->getOutputLines(true)); }
/** * Check if this is a bare repository * @return boolean */ public function isBare() { $options = array(RevParseCommand::OPTION_IS_BARE_REPOSIORY); $this->caller->execute(RevParseCommand::getInstance()->revParse(null, $options)); return trim($this->caller->getOutput()) === 'true'; }