/** * Returns content of the blob. * * @throws ProcessException Error occurred while getting content of blob */ public function getContent() { if (null === $this->content) { $this->content = $this->repository->run('cat-file', array('-p', $this->hash)); } return $this->content; }
/** * Returns array of files whit diff informations. * * @param array $args Additional arguments for log command. * @param type $asArray Returns array if TRUE, instance of Generator otherwise, * @return array|Generator */ public function getFiles(array $args = [], $asArray = false) { $args[] = $this->getCommitHashFrom(); $args[] = $this->getCommitHashTo(); $diffRaw = $this->repository->run('diff', $args); if ($asArray) { $data = []; foreach ($this->parser->parse($diffRaw->getOutput()) as $file) { $data[] = $file; } return $data; } return $this->parser->parse($diffRaw->getOutput()); }
/** * Prepare and run process for log command and returns instance of LogParser. * * @param array $args Additional arguments for log command. * @return LogParser */ protected function getParserOutput(array $args = []) { $logArgs = array_merge(['--numstat', '--summary', '--pretty=format:COMMITSTART%H%n%h%n%P%n%aN%n%ae%n%ct%n%s%n%b%nENDOFOUTPUTGITMESSAGE'], $args); return $this->repository->run('log', $logArgs)->getOutput(); }