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);
    }