diff --git a/hgitaly/service/ref.py b/hgitaly/service/ref.py index 4934b551d540ffb4f80c232371f5274d05ceb1ad_aGdpdGFseS9zZXJ2aWNlL3JlZi5weQ==..68eb7d79d0910fa8a85a3953f59329ad3a6ffd2e_aGdpdGFseS9zZXJ2aWNlL3JlZi5weQ== 100644 --- a/hgitaly/service/ref.py +++ b/hgitaly/service/ref.py @@ -475,6 +475,19 @@ refs = [r for r in refs if r[1].encode('ascii') in pointing_at or r[0] == b'HEAD'] + # ignore `peel_tags`: + # Mercurial has no real equivalent of Git's annotated tags. The + # closest notion would be the tagging changeset, but that is not + # well-defined. Hence Mercurial tags always point to the target commit. + # We could force the `peeled_target` attribute of the `Reference` + # messages, but that would not bring us to better compliance: the + # protocol comment states explicitely that it should stay empty if + # the object is not an annotated tag, and this is confirmed by + # Gitaly Comparison tests (tag created by hg-git in this case). + # On the contrary, filling-in `peeled_target` could very well make + # clients believe that the tag is annotated, leading to dedicated + # actions that can only go wrong. + if len(refs) < (2 if request.head else 1): # avoid yielding an empty response, as Gitaly does not. # TODO consider doing that in the `chunked()` helper, diff --git a/tests_with_gitaly/test_ref.py b/tests_with_gitaly/test_ref.py index 4934b551d540ffb4f80c232371f5274d05ceb1ad_dGVzdHNfd2l0aF9naXRhbHkvdGVzdF9yZWYucHk=..68eb7d79d0910fa8a85a3953f59329ad3a6ffd2e_dGVzdHNfd2l0aF9naXRhbHkvdGVzdF9yZWYucHk= 100644 --- a/tests_with_gitaly/test_ref.py +++ b/tests_with_gitaly/test_ref.py @@ -354,4 +354,3 @@ rpc_helper.assert_compare(pointing_at_oids=[hg_shas[i]], patterns=[b'refs/tags/'], head=head) - # TODO peel tags