/** * build a ls-tree command * * @param string|Branch $ref The reference to build the tree from * * @throws \RuntimeException * @return string */ public function fullTree($ref = 'HEAD') { $what = $ref; if ($ref instanceof TreeishInterface) { $what = $ref->getSha(); } $this->clearAll(); $this->addCommandName(self::LS_TREE_COMMAND); // recurse $this->addCommandArgument('-r'); // show trees $this->addCommandArgument('-t'); $this->addCommandArgument('-l'); $this->addCommandSubject($what); return $this->getCommand(); }
/** * Checkout a treeish reference * * @param string|Branch $ref the reference to checkout * * @throws \RuntimeException * @return string */ public function checkout($ref) { $this->clearAll(); $what = $ref; if ($ref instanceof Branch) { $what = $ref->getName(); } elseif ($ref instanceof TreeishInterface) { $what = $ref->getSha(); } $this->addCommandName(self::GIT_CHECKOUT); $this->addCommandArgument('-q'); $this->addCommandSubject($what); return $this->getCommand(); }