'Peel all tags from a SHA.
:param sha: The object SHA to peel.
:return: The fully-peeled SHA1 of a tag object, after peeling all
intermediate tags; if the original ref does not point to a tag,
this will equal the original SHA1.'

def peel_sha(self, sha):

    obj = self[sha]
    obj_class = object_class(obj.type_name)
    while (obj_class is Tag):
        (obj_class, sha) = obj.object
        obj = self[sha]
    return obj
