示例#1
0
 /**
  * tree of a given path
  *
  * @param string        $ref  reference
  * @param string|Object $path path
  *
  * @throws \RuntimeException
  * @return string
  */
 public function tree($ref = 'HEAD', $path = null)
 {
     if ($path instanceof Object) {
         $subjectPath = $path->getFullPath() . ($path->isTree() ? '/' : '');
     } else {
         $subjectPath = $path;
     }
     $what = $ref;
     if ($ref instanceof TreeishInterface) {
         $what = $ref->getSha();
     }
     $this->clearAll();
     $this->addCommandName(self::LS_TREE_COMMAND);
     $this->addCommandArgument('-l');
     $subject = $what;
     $this->addCommandSubject($subject);
     $this->addPath($subjectPath);
     return $this->getCommand();
 }