'Follow a reference name.
:return: a tuple of (refnames, sha), wheres refnames are the names of
references in the chain'

def follow(self, name):

    contents = (SYMREF + name)
    depth = 0
    refnames = []
    while contents.startswith(SYMREF):
        refname = contents[len(SYMREF):]
        refnames.append(refname)
        contents = self.read_ref(refname)
        if (not contents):
            break
        depth += 1
        if (depth > 5):
            raise KeyError(name)
    return (refnames, contents)
