@classmethod
def init_bare(cls, objects, refs):
    """Create a new bare repository in memory.

        :param objects: Objects for the new repository,
            as iterable
        :param refs: Refs as dictionary, mapping names
            to object SHA1s
        """
    ret = cls()
    for obj in objects:
        ret.object_store.add_object(obj)
    for refname, sha in refs.iteritems():
        ret.refs[refname] = sha
    ret._init_files(bare=True)
    return ret
