fix: correct Windows tag-existence check in justfile - #279
Merged
Conversation
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 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Pull Request Summary 🚀
What does this PR do? 📝
Fixes a broken tag-existence check in the
[windows]variants oftag-version,push-tag,push-all, andbump-and-taginjustfile. These recipes incorrectly reported that a version tag already existed even when it did not, sojust tag-versionsilently skipped tag creation and the release never got tagged/pushed.Why is this change needed? 🤔
While cutting the
v1.1.0rc1pre-release,just tag-versionprinted "Tag v1.1.0rc1 already exists. Skipping tag creation." even thoughgit tagshowed no such tag locally or on the remote — the tag was never created, so the Release workflow never ran and nothing was published to Test PyPI.Root cause:
git rev-parse <ref>echoes the ref name back to stdout even when it fails to resolve (exiting 128). The Windows recipes checkedif (git rev-parse "$TAG" 2>$null), which only silences stderr. PowerShell'sif()evaluates the output of the expression, not the exit code — so that leftover stdout string from the failedrev-parseis always truthy, regardless of whether the tag exists. This means every one of these recipes has always reported "already exists" for any tag, on any Windows machine — it isn't specific tov1.1.0rc1.How was this implemented? 🛠️
Changed each of the four affected
[windows]recipes to suppress all output fromgit rev-parse(*>$null, all streams) and branch on$LASTEXITCODE -eq 0instead of on the command's output truthiness. This matches the semantics of the[unix]recipes, which already usegit rev-parse "$TAG" >/dev/null 2>&1(exit-code-based) and were never affected by this bug.How to test or reproduce ? 🧪
On Windows, reproduce the bug pre-fix:
With the fix:
Verified
just tag-versionnow correctly createsv1.1.0rc1locally when the tag does not yet exist, and correctly reports "already exists" when run again afterward.Screenshots (if applicable) 📷
N/A — build tooling change only.
Checklist ✅
🤖 Generated with Claude Code