def METHOD_NAME(self, path, detail=True, ref=None, **kwargs):
    path = self._strip_protocol(path)
    tree = self._path_to_object(path, ref)
    if isinstance(tree, pygit2.Tree):
        out = []
        for obj in tree:
            if isinstance(obj, pygit2.Tree):
                out.append(
                    {
                        "type": "directory",
                        "name": "/".join([path, obj.name]).lstrip("/"),
                        "hex": obj.hex,
                        "mode": "%o" % obj.filemode,
                        "size": 0,
                    }
                )
            else:
                out.append(
                    {
                        "type": "file",
                        "name": "/".join([path, obj.name]).lstrip("/"),
                        "hex": obj.hex,
                        "mode": "%o" % obj.filemode,
                        "size": obj.size,
                    }
                )
    else:
        obj = tree
        out = [
            {
                "type": "file",
                "name": obj.name,
                "hex": obj.hex,
                "mode": "%o" % obj.filemode,
                "size": obj.size,
            }
        ]
    if detail:
        return out
    return [o["name"] for o in out]