Example #1
0
 /**
  * testOutputLines
  */
 public function testOutputLines()
 {
     $binary = new GitBinary();
     $caller = new Caller($binary, $this->getRepository()->getPath());
     $this->getRepository()->init();
     for ($i = 1; $i <= 50; $i++) {
         $this->addFile('test' . $i, null, 'this is the content');
     }
     $this->getRepository()->commit('first commit', true);
     $command = new LsTreeCommand();
     $outputLines = $caller->execute($command->fullTree($this->getRepository()->getMainBranch()))->getOutputLines();
     $this->assertTrue(is_array($outputLines));
     $this->assertEquals(range(0, count($outputLines) - 1), array_keys($outputLines));
 }
Example #2
0
 /**
  * get the commit properties from command
  *
  * @see LsTreeCommand::tree
  */
 private function createFromCommand()
 {
     $command = LsTreeCommand::getInstance($this->getRepository())->tree($this->ref, $this->subject);
     $outputLines = $this->getCaller()->execute($command)->getOutputLines(true);
     $this->parseOutputLines($outputLines);
 }
Example #3
0
 /**
  * Retrieve an instance of Tree
  * Tree Object is Countable, Iterable and has ArrayAccess for easy manipulation
  *
  * @param string|TreeishInterface $ref  the treeish to check
  * @param string|Object           $path Object or null for root
  *
  * @throws \RuntimeException
  * @throws \Symfony\Component\Process\Exception\LogicException
  * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  * @return Objects\Tree
  */
 public function getTree($ref = 'HEAD', $path = null)
 {
     if (is_string($path) && '' !== $path) {
         $outputLines = $this->getCaller()->execute(LsTreeCommand::getInstance($this)->tree($ref, $path))->getOutputLines(true);
         $path = TreeObject::createFromOutputLine($this, $outputLines[0]);
     }
     return new Tree($this, $ref, $path);
 }