def dir_list(self, tgt_env):
        '''
        Get a list of directories for the target environment using dulwich
        '''
        def _traverse(tree, blobs, prefix):
            '''
            Traverse through a dulwich Tree object recursively, accumulating
            all the empty directories within it in the "blobs" list
            '''
            for item in six.iteritems(tree):
                try:
                    obj = self.repo.get_object(item.sha)
                except __HOLE__:
                    # Entry is a submodule, skip it
                    continue
                if not isinstance(obj, dulwich.objects.Tree):
                    continue
                blobs.append(os.path.join(prefix, item.path))
                if len(self.repo.get_object(item.sha)):
                    _traverse(obj, blobs, os.path.join(prefix, item.path))

        ret = set()
        tree = self.get_tree(tgt_env)
        tree = self.walk_tree(tree, self.root)
        if not isinstance(tree, dulwich.objects.Tree):
            return ret
        blobs = []
        if len(tree):
            _traverse(tree, blobs, self.root)
        if self.root:
            relpath = lambda path: os.path.relpath(path, self.root)
        else:
            relpath = lambda path: path
        add_mountpoint = lambda path: os.path.join(self.mountpoint, path)
        for blob in blobs:
            ret.add(add_mountpoint(relpath(blob)))
        if self.mountpoint:
            ret.add(self.mountpoint)
        return ret
dataset/ETHPy150Open saltstack/salt/salt/utils/gitfs.py/Dulwich.dir_list