fix: date-order tags and scope the write guard

check_version read latest_tag as the first entry of GitHub's REST
listing, which sorts by name (nesoid: 2.5 before 2.5-4, gargoyle:
stable-20090825 before 2026.1.1), and found the declared tag only on that
first page of 100. The newest tag now comes from GraphQL by commit date,
and the declared one is asked for by name on GitHub, GitLab and Forgejo.

The clean-tree guard of the write modes looked at the whole emulators
directory: a loop of --emulator X --rebase-refs refused every profile
after the first it wrote. It now looks at the selected profiles only.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 15:40:56 +02:00
1 parent 18fc5ce53f
commit 9dd2a3d95f
4 files changed
+169 -21

No files matched your search

+14
View File
@@ -3152,6 +3152,7 @@ class TestCheckVersion(unittest.TestCase):
"tagsha" if tag == "v3.0.0" else None
)
)
profile_sync.upstream.tag_commit = profile_sync.upstream.resolve_tag_commit
def tearDown(self):
(
@@ -4530,6 +4531,19 @@ class TestEmulatorsDirStatus(unittest.TestCase):
Path(root, "a.yml").write_text("emulator: a\n")
self.assertTrue(profile_sync.emulators_dir_is_dirty(root))
def test_only_the_selected_profiles_count(self):
# A loop of --emulator X --rebase-refs refused every profile after
# the first one it wrote.
with tempfile.TemporaryDirectory() as root:
self._git("init", "-q", cwd=root)
Path(root, "a.yml").write_text("emulator: a\n")
Path(root, "b.yml").write_text("emulator: b\n")
self._git("add", "a.yml", "b.yml", cwd=root)
self._git("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "p", cwd=root)
Path(root, "a.yml").write_text("emulator: a2\n")
self.assertTrue(profile_sync.emulators_dir_is_dirty(root, ["a"]))
self.assertFalse(profile_sync.emulators_dir_is_dirty(root, ["b"]))
def test_a_tree_outside_any_repository_is_not_clean(self):
with tempfile.TemporaryDirectory() as root, mock.patch.dict(
os.environ, {"GIT_CEILING_DIRECTORIES": str(Path(root).parent)}