'Get contents of the packed-refs file.
:return: Dictionary mapping ref names to SHA1s
:note: Will return an empty dictionary when no packed-refs file is
present.'

def get_packed_refs(self):

    if (self._packed_refs is None):
        self._packed_refs = {}
        self._peeled_refs = {}
        path = os.path.join(self.path, 'packed-refs')
        try:
            f = GitFile(path, 'rb')
        except IOError as e:
            if (e.errno == errno.ENOENT):
                return {}
            raise
        with f:
            first_line = next(iter(f)).rstrip()
            if (first_line.startswith('#    pack-refs') and ('    peeled' in first_line)):
                for (sha, name, peeled) in read_packed_refs_with_peeled(f):
                    self._packed_refs[name] = sha
                    if peeled:
                        self._peeled_refs[name] = peeled
            else:
                f.seek(0)
                for (sha, name) in read_packed_refs(f):
                    self._packed_refs[name] = sha
    return self._packed_refs
