/**
  * {@inheritdoc}
  */
 public function getDirectory($path, CommitInterface $commit = null)
 {
     if (!$commit) {
         $treeWalker = $this->getTreeWalker();
     } else {
         $treeWalker = $this->treeManager->getTreeWalker($commit->getTree());
     }
     $node = $treeWalker->walk($path);
     if ($node === null) {
         throw new DirectoryNotExistsException($path);
     }
     if ($node->getIsFile()) {
         throw new NotATreeException($path);
     }
     return $node;
 }