From 0ec4ccbe40261f424c35834cb058f0f0a6f1a626 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 12 Dec 2025 10:26:22 +0100 Subject: [PATCH] **fix(release): force-fetch remote tags and align tests** * Treat remote tags as the source of truth by force-fetching tags from *origin* * Update preview output to reflect the real fetch behavior * Align unit tests with the new forced tag fetch command https://chatgpt.com/share/693bdfc3-b8b4-800f-8adc-b1dc63c56a89 --- src/pkgmgr/actions/release/git_ops.py | 5 ++--- tests/unit/pkgmgr/actions/release/test_git_ops.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkgmgr/actions/release/git_ops.py b/src/pkgmgr/actions/release/git_ops.py index edddc67..b195f00 100644 --- a/src/pkgmgr/actions/release/git_ops.py +++ b/src/pkgmgr/actions/release/git_ops.py @@ -42,15 +42,14 @@ def ensure_clean_and_synced(preview: bool = False) -> None: return if preview: - print("[PREVIEW] Would run: git fetch --prune --tags") + print("[PREVIEW] Would run: git fetch origin --prune --tags --force") print("[PREVIEW] Would run: git pull --ff-only") return print("[INFO] Syncing with remote before making any changes...") - run_git_command("git fetch --prune --tags") + run_git_command("git fetch origin --prune --tags --force") run_git_command("git pull --ff-only") - def is_highest_version_tag(tag: str) -> bool: """ Return True if `tag` is the highest version among all tags matching v*. diff --git a/tests/unit/pkgmgr/actions/release/test_git_ops.py b/tests/unit/pkgmgr/actions/release/test_git_ops.py index cf65f88..a458841 100644 --- a/tests/unit/pkgmgr/actions/release/test_git_ops.py +++ b/tests/unit/pkgmgr/actions/release/test_git_ops.py @@ -109,10 +109,11 @@ class TestEnsureCleanAndSynced(unittest.TestCase): ensure_clean_and_synced(preview=False) called_cmds = [c.args[0] for c in mock_run.call_args_list] - self.assertIn("git fetch --prune --tags", called_cmds) + self.assertIn("git fetch origin --prune --tags --force", called_cmds) self.assertIn("git pull --ff-only", called_cmds) + class TestIsHighestVersionTag(unittest.TestCase): @patch("pkgmgr.actions.release.git_ops.subprocess.run") def test_is_highest_version_tag_no_tags_true(self, mock_run) -> None: