From cafa609a39222c27f336aac757e94cadc0d73674 Mon Sep 17 00:00:00 2001 From: iabaako Date: Sun, 23 Aug 2026 16:16:59 +0530 Subject: [PATCH] fix: correct Windows tag-existence check in justfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git rev-parse echoes the ref name to stdout even when it fails to resolve (exit 128). The [windows] recipes for tag-version, push-tag, push-all, and bump-and-tag checked `if (git rev-parse "$TAG" 2>$null)`, which only silences stderr — PowerShell's if() evaluates the leftover stdout string as truthy regardless of exit code, so every one of these recipes reported "tag already exists" for tags that were never created. Discovered when `just tag-version` for v1.1.0rc1 claimed the tag existed while `git tag` showed no such tag locally or on the remote. Suppress all output with `*>$null` and branch on $LASTEXITCODE instead. Co-Authored-By: Claude Sonnet 5 --- Justfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Justfile b/Justfile index 5ea021bd..ea00aed3 100644 --- a/Justfile +++ b/Justfile @@ -246,7 +246,7 @@ bump-and-tag +bumps: [windows] bump-and-tag +bumps: - @uv run python scripts/check_changelog.py {{ bumps }}; if ($LASTEXITCODE -ne 0) { exit 1 }; $status = & git status --porcelain; if ($status) { Write-Host "Error: Git repository has uncommitted changes. Please commit or stash them first."; exit 1 }; $OLD_VERSION = & uv version --short; Write-Host "Current version: $OLD_VERSION"; Write-Host "Bumping version ({{ bumps }})..."; & uv version {{ prepend("--bump=", bumps) }}; if ($LASTEXITCODE -ne 0) { exit 1 }; $NEW_VERSION = & uv version --short; Write-Host "New version: $NEW_VERSION"; Write-Host "Updating lock file with uv sync..."; & uv sync; & git add pyproject.toml uv.lock; & git commit -m "Bump version: $OLD_VERSION → $NEW_VERSION"; $TAG = "v$NEW_VERSION"; if (git rev-parse "$TAG" 2>$null) { Write-Host "Tag $TAG already exists. Skipping tag creation." } else { Write-Host "Creating git tag $TAG..."; git tag -a "$TAG" -m "Version $NEW_VERSION"; Write-Host "Created git tag: $TAG"; Write-Host "To push the tag, run: git push origin $TAG" } + @uv run python scripts/check_changelog.py {{ bumps }}; if ($LASTEXITCODE -ne 0) { exit 1 }; $status = & git status --porcelain; if ($status) { Write-Host "Error: Git repository has uncommitted changes. Please commit or stash them first."; exit 1 }; $OLD_VERSION = & uv version --short; Write-Host "Current version: $OLD_VERSION"; Write-Host "Bumping version ({{ bumps }})..."; & uv version {{ prepend("--bump=", bumps) }}; if ($LASTEXITCODE -ne 0) { exit 1 }; $NEW_VERSION = & uv version --short; Write-Host "New version: $NEW_VERSION"; Write-Host "Updating lock file with uv sync..."; & uv sync; & git add pyproject.toml uv.lock; & git commit -m "Bump version: $OLD_VERSION → $NEW_VERSION"; $TAG = "v$NEW_VERSION"; git rev-parse $TAG *>$null; if ($LASTEXITCODE -eq 0) { Write-Host "Tag $TAG already exists. Skipping tag creation." } else { Write-Host "Creating git tag $TAG..."; git tag -a "$TAG" -m "Version $NEW_VERSION"; Write-Host "Created git tag: $TAG"; Write-Host "To push the tag, run: git push origin $TAG" } # Create git tag from current version if it doesn't exist [unix] @@ -267,7 +267,7 @@ tag-version: [windows] tag-version: - @$VERSION = & uv version --short; $TAG = "v$VERSION"; if (git rev-parse "$TAG" 2>$null) { Write-Host "Tag $TAG already exists. Skipping tag creation." } else { Write-Host "Creating git tag $TAG..."; git tag -a "$TAG" -m "Version $VERSION"; Write-Host "Created git tag: $TAG"; Write-Host "To push the tag, run: git push origin $TAG" } + @$VERSION = & uv version --short; $TAG = "v$VERSION"; git rev-parse $TAG *>$null; if ($LASTEXITCODE -eq 0) { Write-Host "Tag $TAG already exists. Skipping tag creation." } else { Write-Host "Creating git tag $TAG..."; git tag -a "$TAG" -m "Version $VERSION"; Write-Host "Created git tag: $TAG"; Write-Host "To push the tag, run: git push origin $TAG" } # Push the latest version tag to remote [unix] @@ -288,7 +288,7 @@ push-tag: [windows] push-tag: - @$VERSION = & uv version --short; $TAG = "v$VERSION"; if (git rev-parse "$TAG" 2>$null) { Write-Host "Pushing tag $TAG to remote..."; git push origin "$TAG"; Write-Host "Tag $TAG pushed successfully!" } else { Write-Host "Tag $TAG does not exist locally. Create it first with 'just tag-version'."; exit 1 } + @$VERSION = & uv version --short; $TAG = "v$VERSION"; git rev-parse $TAG *>$null; if ($LASTEXITCODE -eq 0) { Write-Host "Pushing tag $TAG to remote..."; git push origin "$TAG"; Write-Host "Tag $TAG pushed successfully!" } else { Write-Host "Tag $TAG does not exist locally. Create it first with 'just tag-version'."; exit 1 } # Push both commits and tag to remote [unix] @@ -313,7 +313,7 @@ push-all: [windows] push-all: - @$VERSION = & uv version --short; $TAG = "v$VERSION"; Write-Host "Pushing commits to remote..."; git push; if (git rev-parse "$TAG" 2>$null) { Write-Host "Pushing tag $TAG to remote..."; git push origin "$TAG"; Write-Host "All changes pushed successfully!" } else { Write-Host "Tag $TAG does not exist locally. Create it first with 'just tag-version'."; exit 1 } + @$VERSION = & uv version --short; $TAG = "v$VERSION"; Write-Host "Pushing commits to remote..."; git push; git rev-parse $TAG *>$null; if ($LASTEXITCODE -eq 0) { Write-Host "Pushing tag $TAG to remote..."; git push origin "$TAG"; Write-Host "All changes pushed successfully!" } else { Write-Host "Tag $TAG does not exist locally. Create it first with 'just tag-version'."; exit 1 } # Clean build artifacts [unix]