Tagged Refresh Support
Tag checkout support added to refresh:prod in 3.4.1
Overview
v3.4.1 fixed the production refresh script so tagged releases can be checked out cleanly, removing the assumption that production always lands on a branch.
The Problem
Before this fix, refresh-prod-checkout.ts only handled remote branches and local branches. If neither matched, it fell through to a plain git switch -- <ref>, which fails for tags because git switch expects a branch name by default.
The Fix
Two new verification steps were added when neither a remote nor local branch is found:
- Tag check - uses
git show-ref --verify --quiet refs/tags/<ref>to test if the ref is a tag - Commitish check - uses
git rev-parse --verify --quiet <ref>^{commit}to test if the ref resolves to a valid commit (e.g., a raw SHA)
If neither resolves, the script fails with a clear error message. If one does resolve, it switches using git switch --detach -- <ref>, entering detached HEAD mode - the correct behavior for tags and bare commits that are not branch tips.
Files Touched
| File | Change |
|---|---|
scripts/refresh-prod-checkout.ts | Modified (+25 / -3 lines) |