# HG changeset patch # User Daniel Dourvaris # Date 2016-09-12 03:57:22 # Node ID 0b6ca72aa8fc8b3ab744cc4c70faca204934aac5 # Parent da50e6f0b152fc0c1661395fb24fa75da3252dc0 git: use peeled commit hashes for get_refs so that annotated tags work, fixes #4223 diff --git a/vcsserver/git.py b/vcsserver/git.py --- a/vcsserver/git.py +++ b/vcsserver/git.py @@ -429,28 +429,15 @@ class GitRemote(object): return list(getattr(obj, a) for a in attrs) @reraise_safe_exceptions - def get_refs(self, wire, keys=None): - # FIXME(skreft): this method is affected by bug - # http://bugs.rhodecode.com/issues/298. - # Basically, it will overwrite previously computed references if - # there's another one with the same name and given the order of - # repo.get_refs() is not guaranteed, the output of this method is not - # stable either. + def get_refs(self, wire): repo = self._factory.repo(wire) - refs = repo.get_refs() - if keys is None: - return refs - _refs = {} - for ref, sha in refs.iteritems(): - for k, type_ in keys: - if ref.startswith(k): - _key = ref[len(k):] - if type_ == 'T': - sha = repo.get_object(sha).id - _refs[_key] = [sha, type_] - break - return _refs + repo.refs._peeled_refs + result = {} + for ref, sha in repo.refs.as_dict().items(): + peeled_sha = repo.refs._peeled_refs.get(ref, sha) + result[ref] = peeled_sha + return result @reraise_safe_exceptions def get_refs_path(self, wire):