# HG changeset patch
# User Georges Racinet <georges.racinet@octobus.net>
# Date 1686074122 -7200
#      Tue Jun 06 19:55:22 2023 +0200
# Branch stable
# Node ID 3c6b018d3924495530554ac84edf69a509b37915
# Parent  bbca598ebf82d6f6ed17497f4c6b1de1cd8356b3
FindCommit comparison tests: ensure only GitLab state files are used

Previously, the test was passing because the Python reference implementation
of HGitaly relies on `scmutil.revsingle` for revisions not found in GitLab
state files, including tags given in simple form (e.g. `v1.2.3`).

But RHGitaly will rely on the GitLab state files only, hence we need to
ensure that the tags state file contains the one we introduce, which is
shadowing in the short SHA case

The added GitLab sync has the effect of removing directly set tags that have
no Mercurial counterpart from the GitLab state file, that's why it has to occur
before `write_ref()` in this test of collision/shadowing were Mercurial and Git
tags must have different names.

diff --git a/tests_with_gitaly/test_commit.py b/tests_with_gitaly/test_commit.py
--- a/tests_with_gitaly/test_commit.py
+++ b/tests_with_gitaly/test_commit.py
@@ -269,6 +269,7 @@
     for hg_sha_tag, git_sha_tag in ((hg_sha0, git_sha0),
                                     (hg_sha0[:10], git_sha0[:10])):
         wrapper.command('tag', hg_sha_tag, rev=hg_sha1)
+        wrapper.command('gitlab-mirror')
         git_repo.write_ref(b'refs/tags/' + git_sha_tag, git_sha1)
 
         assert rpc_helper.hg2git(