'Set a ref.
:param name: ref name
:param value: Ref value - either a ShaFile object, or a hex sha'

def __setitem__(self, name, value):

    if (name.startswith('refs/') or (name == 'HEAD')):
        if isinstance(value, ShaFile):
            self.refs[name] = value.id
        elif isinstance(value, bytes):
            self.refs[name] = value
        else:
            raise TypeError(value)
    else:
        raise ValueError(name)
